Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014

    Copy EVERYTHING please

    I'm trying to copy all the files from my project CD to the user’s hard drive. This is the code I am using:

    ==ON CLICK==
    --get the destination folder
    sDestFolder = Dialog.FolderBrowse("Select the Destination Folder", _DesktopFolder)
    --see if the user cancelled
    if sDestFolder ~= "CANCEL" then
    --initiate the copy
    --CopyFolder is function in the Global Functions area of the project (Alt-D-F)
    if CopyFolder(_SourceFolder, sDestFolder) == 0 then
    result = Dialog.Message("Folder Copy", "The folder has been successfully copied!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    result = Dialog.Message("Folder Copy", "There was an error copying the folder.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end
    end



    ==GLOBAL==
    function CopyFolder(sSource, sDestination)
    local m_sFolder;
    local m_FoundFolder;
    local error;

    --Find all the folders and sub-Folders
    --results are stored in the table m_tblFolders
    m_tblFolders = Folder.Find(sSource, "*", true, nil);

    --if our destination folder does not have the
    --backslash as the last character, add it
    if String.Right(sDestination, 1) ~= "\\" then
    sDestination = sDestination .. "\\";
    end

    --m_tblFolders will be nil if there are no folders
    if m_tblFolders ~= nil then
    --enumerate through the found folders
    for n, m_FoundFolder in m_tblFolders do
    --replace the source's path with the destination's path
    m_sFolder = String.Replace(m_FoundFolder, sSource, sDestination, false);
    --create the folder
    Folder.Create(m_sFolder);
    error = Application.GetLastError();
    if (error ~= 0) then
    --set n to value to exit FOR loop
    n = Table.Count(m_tblFolders)
    end
    end
    end

    --if no errors occurred, copy the files
    if (error == 0) then
    --show the status dialog
    StatusDlg.Show(MB_ICONNONE, false);
    --copy all files from the source folder, with recurse.
    File.Copy(sSource .. "\\*.*", sDestination, true, true, false, true, nil);
    --hide the status dialog
    StatusDlg.Hide();
    error = Application.GetLastError();
    end

    --clean up
    m_tblFolders = nil;
    return error;
    end


    Not all the files want to be copied including the AutoPlay.exe

  2. #2
    Join Date
    Aug 2003
    Posts
    2,427
    I know it's not an answer Bruce but how about creating a seperate zip of your whole app and putting that in docs - unzip instead of copying.

    I wonder, could the problem be something to do with file locking even though the files are on CD?

  3. #3
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Hey longedge-
    Good idea I didn't think of that. Problem is, every CD is a little different. Each CD is dynamically produced so the time needed to zip everyone would be a pain.

    I'll take a look at the locking idea, thanks

  4. #4
    Join Date
    Aug 2003
    Posts
    2,427
    Just another thought that's only relevant if the dynamic part of your distribution is not in the executable.

    You could have a generic zip file with the files that don't copy properly and then do as you do now with the dynamic files.

  5. #5
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Will copy a file if it is in use? Could that be stopping the copy function?
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  6. #6
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Bruce ..try this 'Root path fix' (common issue if wanting to duplicate from the
    'root' of a source ..CD or Hardisk.

    replace below line:

    if CopyFolder(_SourceFolder, sDestFolder) == 0 then

    with:

    Code:
    _SourceFolder = String.Mid(_SourceFolder, 1, 2).."\\"; --Source is now set for Root of CD
    if CopyFolder(_SourceFolder, sDestFolder) == 0 then

    HTH

    (normally files 'in use' can still be copied)

  7. #7
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Note: for non NT type Oss..drop the "\\" (is appended in the copy func anyway) and use:

    _SourceFolder = String.Mid(_SourceFolder, 1, 2);
    Last edited by Eagle; 08-24-2005 at 07:34 AM.

  8. #8
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Thanks Eagle I'll try it out.

Similar Threads

  1. Function to Copy a Folder, Sub-folders and files
    By Worm in forum AutoPlay Media Studio 5.0
    Replies: 50
    Last Post: 05-06-2006, 07:49 AM
  2. Obtaining a replacement copy of the commercial installer.
    By BSchkerke in forum TrueUpdate 1.0
    Replies: 1
    Last Post: 03-15-2004, 09:09 AM
  3. Re: Copy vs. Drag...
    By Protocol in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 10-30-2003, 08:27 AM
  4. Copy Protection
    By darkstar1309 in forum AutoPlay Media Studio 4.0
    Replies: 12
    Last Post: 04-16-2003, 07:42 PM
  5. Copy subfolders
    By Madmunk in forum Setup Factory 6.0
    Replies: 6
    Last Post: 02-10-2002, 07:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts