Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2006, 11:04 PM
Johan?? Johan?? is offline
Junior Member
 
Join Date: Jun 2006
Posts: 6
Default How to Transfer files Form Folder to Folder??????

Can Anybody tell How I can Transfer or Copy Files From One Fodler to another
Reply With Quote
  #2  
Old 12-02-2006, 11:28 PM
digitiger digitiger is offline
Senior Member
 
Join Date: Jan 2001
Posts: 716
Default 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
Reply With Quote
  #3  
Old 12-03-2006, 06:52 AM
struct struct is offline
Senior Member
 
Join Date: Nov 2003
Posts: 667
Default 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;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:45 AM.


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