DELPHI 怎么复制一个文件夹
注: 文件夹 下还有子文件夹 子文件夹下 还有 子文件夹 还有里面所有的文件
注: 文件夹 下还有子文件夹 子文件夹下 还有 子文件夹 还有里面所有的文件
解决方案 »
- ??简单ListBox问题 ??
- 一个函数调用的问题
- 如何实现监控用户登录WINDOWS系统
- Runtime error 105 这是什么错误?
- 一个关于用Edit输入日期的问题!
- 一个关于sqlserver2000数据读取的问题!!!!!!!!!!!我急用呀?
- 关于deletefile()
- 请问,如何制作像office助手、金山毒霸大官家这样的卡通人物?
- 救急!char **str;的数据用Object Pascal描述应该是什么
- 急!向各位哥哥姐姐求救!
- ListBox的问题!!在线!!
- 这个错误是怎么回事?[Error] PrintInfo.pas(36): Statement expected, but expression of type 'TfrPreview' found
procedure TForm1.copyPathFile( strSourFilePath:string; DeFieldpath:string);//将一个文件夹内文件复制到另外一个文件夹内
var
OpStruc:TSHFileOpStruct;
FromBuf,ToBuf:Array[0..128] of Char;
begin
try
FillChar(FromBuf,Sizeof(FromBuf),0);
FillChar(ToBuf,Sizeof(ToBuf),0);
StrPCopy(FromBuf,Pchar(strSourFilePath));
//strSourFilePath
StrPCopy(ToBuf,Pchar(DeFieldpath));
with OpStruc do
begin
Wnd:=handle;
wFunc:=FO_COPY;
pFrom:=@FromBuf;
pTo:=@ToBuf;
fFlags:=FOF_NOCONFIRMATION or FOF_MULTIDESTFILES or FOF_SIMPLEPROGRESS;// or FOF_RENAMEONCOLLISION;
fAnyOperationsAborted:=False;
hNameMappings:=nil;
lpszProgressTitle:=nil;
end;
if SHFileOperation(OpStruc)=0 then
begin
end;
except
raise Exception.Create('错误');
end;
end;
var
OpStruc:TSHFileOpStruct;
FromBuf,ToBuf:Array[0..128] of Char;
begin
try
FillChar(FromBuf,Sizeof(FromBuf),0);
FillChar(ToBuf,Sizeof(ToBuf),0);
StrPCopy(FromBuf,Pchar(strSourFilePath));
//strSourFilePath
StrPCopy(ToBuf,Pchar(DeFieldpath));
with OpStruc do
begin
Wnd:=handle;
wFunc:=FO_COPY;
pFrom:=@FromBuf;
pTo:=@ToBuf;
fFlags:=FOF_NOCONFIRMATION or FOF_MULTIDESTFILES or FOF_SIMPLEPROGRESS;// or FOF_RENAMEONCOLLISION;
fAnyOperationsAborted:=False;
hNameMappings:=nil;
lpszProgressTitle:=nil;
end;
if SHFileOperation(OpStruc)=0 then
begin
end;
except
raise Exception.Create('错误');
end;
end;用这个API干净利落
BOOL CopyFile(
LPCTSTR lpExistingFileName,// pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);