Solved

File manipulation

Posted on 1997-04-02
1
165 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 50 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
select query - oracle 16 103
can't find the executable in Simulator 1 130
control image tags in a string ? 12 171
PHP preg_replace code convert to Delphi 14 98
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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