Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

File manipulation

Posted on 1997-04-02
1
Medium Priority
?
167 Views
Last Modified: 2010-04-03
Is there a procedure I should use to do the following things in Delphi?

I have two files A and B, and I want to:

- Delete file A on disk
- Rename file B as A

I have tried the following code but it doesn't work, it's like if the processor pass throught renaming step because deleting file A is not finished yet (the disk is too slow for the processor in multitasking win95)....

DeleteFile('c:\developp\Delphi\Patrick\CourrierElec\setbox.ini');

RenameFile('c:\developp\Delphi\Patrick\CourrierElec\setboxtemp.ini','c:\developp\Delphi\Patrick\CourrierElec\setbox.ini')

So, if you can help, I will appreciate it :)

Patrick St-Amant
0
Comment
Question by:pasta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1335099
You can try this:

var value: boolean;

    chdir('c:\directory');  //Move where your files are stored
    DeleteFile('file1');

    value:=False;

    while (not value) do
    begin
          chdir('c:\directory');
          value:=RenameFile('file2','file1');
    end;

Hope this helps.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question