Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   How to Transfer files Form Folder to Folder?????? (http://www.delphipages.com/forum/showthread.php?t=176025)

Johan?? 12-02-2006 11:04 PM

How to Transfer files Form Folder to Folder??????
 
Can Anybody tell How I can Transfer or Copy Files From One Fodler to another

digitiger 12-02-2006 11:28 PM

RE: How to Transfer files Form Folder to Folder??????
 
Though there are multiple ways and also you can use WINAPIs directly also. but if you are looking for simple option then just add the following file to you project, and also add its name to the USES clause in your source file:

..\Delphi7\Demos\Doc\Filmanex\FmxUtils.pas

this file has a Procedure named "CopyFile(const FileName, DestName: string)" and Renamefile and Deletefile also

Suppose you want to copy file named "ABC.txt" from folder ABC to XYZ then you can do so simply by following statement

CopyFile('C:\ABC\ABC.txt', 'C:\XYZ\ABC.txt');

Hope it helps and if it does then do accept the answere

struct 12-03-2006 06:52 AM

RE: How to Transfer files Form Folder to Folder??????
 
[DELPHI]// File Operations
// Uses windows internal file handling!

USES ShellAPI;

//Action could be FO_MOVE,FO_DELETE,FO_COPY,FO_RENAME
procedure FileSystemAction(action:longint;fromDir,toDir:stri ng);
var SHFileOp:TSHFileOpStruct;
begin
With SHFileOp do
begin
wnd := Form1.handle;
wFunc := action;
pFrom := Pchar(fromDir +#0+#0);
pTo := Pchar(toDir +#0+#0);
fFlags := FOF_SILENT or FOF_NOCONFIRMATION;

fAnyOperationsAborted := false;
hNameMappings := NIL;
lpszProgressTitle := NIL;
end;
SHFileOperation(SHFileOp);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
FileSystemAction(FO_MOVE,'c:\myfile.zip','c:\mybac kup\myfile.zip');
end;[/DELPHI]

Letting windows handle the move will bring up the windows moving dialog that lets the user know what is happening.

Code:

I love this forum!
function LearnSomethingNew(User:String):Boolean;



All times are GMT. The time now is 04:27 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.