複製某一目錄下的所有檔案至特定路徑

由 擦肩而過 發表於 2005/06/6, 分類:Borland C++, 程式技術 -- (已閱讀 1810 次), 1個留言
 推到 Facebook!    推到 Twitter!    推到 Plurk!   推到 FunP! 
 

  1. void _xcopy(AnsiString ASourceDir,AnsiString ADestDir)
  2. {
  3. TSearchRec FileRec;
  4. AnsiString Sour;
  5. AnsiString Dest;
  6. Sour = ASourceDir;
  7. Dest = ADestDir;
  8. if(Sour[Sour.Length()] != '\\' ) Sour = Sour+ '\\';
  9. if(Dest[Dest.Length()] != '\\' ) Dest = Dest+ '\\';
  10. if(! DirectoryExists(ASourceDir))
  11. {
  12. ShowMessage("來源目錄不存在!!");
  13. }
  14. else
  15. {
  16. if(! DirectoryExists(ADestDir))
  17. {
  18. ForceDirectories(ADestDir);
  19. }
  20. if(FindFirst(Sour+"*.*",faAnyFile,FileRec) == 0)
  21. {
  22. do {
  23. if(FileRec.Attr == 16)
  24. {
  25. if((FileRec.Name != ".") && (FileRec.Name != ".."))
  26. _xcopy(Sour+FileRec.Name,Dest+FileRec.Name);
  27. }
  28. else
  29. {
  30. CopyFile((Sour+FileRec.Name).c_str(),(Dest+FileRec.Name).c_str(),false);
  31. }
  32. }while(FindNext(FileRec) == 0);
  33. }
  34. FindClose(FileRec);
  35. }
  36. }



本週熱門文章
  • Facebook 寶石方塊 (Bejeweled Blitz) 25K分 密技 cheat (94449)
  • Facebook Home Inn (myhomeinn) coin cheat 金錢 密技 (52767)
  • Facebook 開心水族箱(My Fishbowl) 密技 cheat (267156)
  • Facebook 開心水族箱(My Fishbowl) 密技 cheat-第二彈 (234849)
  • Facebook 餐城 (Restaurant City) 很超過的洗錢密技 (286879)
  • Facebook 餐城 (Restaurant City) 最方便的密技 cheat (224105)
  • Facebook 餐城 (Restaurant City) 快速經驗值升級 密技 (162350)
  • Facebook 快樂水族箱 Happy Aquarium 經驗值 密技 (52723)
  • Facebook 開心水族箱(My Fishbowl) 大爆走 (40358)
  • Facebook 寵社 Pet Society 超快速增加經驗值密技 (54915)





  • 填寫留言