Solved

File manipulation

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 57
Delphi 2 60
how to update exe applicatio from internet ? 6 78
firemonkey Android Listview Sort items 7 13
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

777 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