Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

CopyFile Functionality?


2 replies to this topic

finding_this_difficult

finding_this_difficult
  • Members
  • 21 posts

Posted 20 July 2005 - 21:57

I have been fighting this for a little while, but it seems that CopyFile and XCopyFile are suppose to be able to copy a folder and its subfolders. It even says so in the documentation:
// Copy all files in the source directory, including files
// in subdirectories, to the target directory.
nResult = CopyFile(SOURCE_DIR ^ "*.*", TARGET_DIR ^ "*.*");

However, this simply does not work. I have a Folder that has a file and another folder with a second file. Only the first file is copied over.

Is there a better way to do this? Is there something wrong? Has anyone come across this before?

Thanks,
A

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 21 July 2005 - 12:32

I believe that this comment in the sample code is wrong. CopyFile cannot copy subdirectories, only XCopyFile can.

finding_this_difficult

finding_this_difficult
  • Members
  • 21 posts

Posted 21 July 2005 - 13:53

Yeah, I finally figured it out.

XCopyFile(INSTALLDIR ^ sFilename, TempFolder ^ "ImageNow\\Backup\\" + sFilename, COMP_NORMAL | INCLUDE_SUBDIR);

I was missing the COMP_NORMAL. The XCopyFile showed an example with just INCLUDE_SUBDIR and it wasn't working, so I threw in COMP_NORMAL for fun and it worked, go figure.

Thanks for the help,
A