void CopyDir(String Path,String Path2)
{
TSearchRec F;
Path=Path+"\\";
Path2=Path2+"\\";
FindFirst((Path+"*.*").c_str(),faAnyFile|faDirectory,F);
do{
if((F.Attr==faDirectory)&&(F.Name!=".")&&(F.Name!=".."))
{
if(!DirectoryExists(Path2+F.Name))
{
if(!CreateDir(Path2+F.Name))
{
Application->MessageBoxA("文件传送过程中发生错误!请重试","信息",48) ;//异常
abort();
}
}
CopyDir(Path+F.Name,Path2+F.Name);
}
else
{
if((F.Name!=".")&&(F.Name!=".."))
{
if (!FileExists(Path2+F.Name))
{
CopyFile((Path+F.Name).c_str(),(Path2+F.Name).c_str(),true);
Main->StatusBar1->Panels->Items[1]->Text=(Path+F.Name)+"拷贝入"+(Path2+F.Name);
Main->StatusBar1->Repaint();
}
}
}
}
while(FindNext(F)==0);
FindClose(F);
}
--------------------next---------------------
阅读(995) | 评论(0) | 转发(0) |