Announcement

Collapse
No announcement yet.

Recursive Folder Copy Function?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Recursive Folder Copy Function?

    Is there a way to recursively copy a folder (including all sub-folders and files)? I see there is a Folder.DeleteTree, so maybe there is something like Folder.CopyTree(String source, String destination)? Or if there isn't a direct way to do this, could someone suggest a way I might implement this myself using existing functionality? I am running version 7.5.1004.0.
    Last edited by djperry; 01-15-2009, 08:57 AM. Reason: Specify version and clarify CopyTree parameters.

  • #2
    Found it

    I found the code that appears to be working well here https://www.indigorose.com/forums/showthread.php?t=6797

    Sorry about that.

    Comment


    • #3
      theme and extension to the C: \ Windows \ Resources \ Themes want to copy into

      if CopyFolder ("AutoPlay \ \ Docs \ \ Milan", "C:\\Windows\\Resources\\Themes") == 0 then
      result = Dialog.Message ("Theme Applied", "Personalize your desktop, right-click and select the theme, saying.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
      end
      Where is the problem?
      Last edited by milano88; 11-14-2010, 02:35 PM.

      Comment


      • #4
        I use version 8 but as far I know the function "CopyFolder" does not exist.

        The function to copy folder contents is File.Copy (<source>, <destination>, <recurse subfolders>, and other options...).

        Because File.Copy does returns nothing, you should use Application.GetLastError () to determine whether this action failed, and why.

        So, your code should be:

        Code:
        File.Copy ("AutoPlay\\Docs\\Milan", "C:\\Windows\\Resources\\Themes\\*.*", true);
        if Application.GetLastError () == 0 then 
           result = Dialog.Message ("Theme Applied", "Personalize your desktop, right-click and select the theme, saying.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        end
        Don't forget that "Any folders in the destination path must already exist when performing this action, or an error will result."
        We are slowly invading your planet to teach lazy humans to read the user manual.
        But don't be scared: we are here to help.

        Comment

        Working...
        X