Page 1 of 1

Copying directories

Posted: Tue Oct 19, 2010 7:53 am
by NickDay
I need to copy the contents of a folder which will be a the root of the CD drive from which my installer is running, into the target directory. The content will be OEM specific documentation files and folders, which cannot be built into my installer.

I have been trying:

Comment: copy ..\..\..\Documentation to target folder.
Create Folder $TARGETDIR$\Documentation
Set Variable DocPath to $EXEDIR$
Extract Parent Folder: DocPath
Extract Parent Folder: DocPath
Extract Parent Folder: DocPath
Copy Local Files $DocPath$\Documentation\*.* to $TARGETDIR$\Documentation\*.*
Apply Install (get result into variable SUCCESS)

But nothing is copied; I end up with an empty folder. I tried debugging, but EXEDIR is then set to the IA IDE executable's location. I copied a file from another location into this folder (via IA) successfully, so it appears not to be a permissions problem.

Can anyone see what I'm doing wrong, please?

Even if this was working, I believe it would only copy files but not directories. Is there a way to copy the directories without knowing their names in advance?

Thanks for any advice

Re: Copying directories

Posted: Tue Oct 19, 2010 11:29 am
by dunion
If you go above the directories you want to copy and do a *.* you can set it to get all subdirectories and it will recurse.
I've been using a single uncompressed folder mostly but the path variable you are looking for for the CD's root is I believe
$SFXPATH$

Re: Copying directories

Posted: Tue Oct 19, 2010 8:32 pm
by mills
If you copy the files in an uncompressed setup to a CD, EXEDIR and ROOTDIR should equal the CD/DVD drive when the setup is run.

Re: Copying directories

Posted: Tue Oct 26, 2010 8:20 am
by NickDay
Hi Dunion and Andy,

Thanks for your replies. Apologies for my delay in replying. At last I have it copying files. I think my problem may have been due to an additional \ in the source path; I've now added a message dialog to my project, so I can at least see the values of the variables at runtime as I'm unable to test this by debugging.

However, despite using
Copy Local Files $DocPath$\*.* to $TARGETDIR$\Documentation\*.*
it is only copying files from the source path, not folders. So any suggestions would be welcome.

Nick

Re: Copying directories

Posted: Tue Oct 26, 2010 10:57 am
by NickDay
Dunion, you mentioned you could "you can set it to get all subdirectories". Did you really mean there's a setting for this? I'm just using Copy Local Files; setting the source and target folders appropriately, and using *.* in the source and target files fields. Did you do something different, to persuade it to copy folders recursively, please?

Re: Copying directories

Posted: Tue Oct 26, 2010 9:11 pm
by mills
You'll want to use XCOPY. Something like:

Code: Select all

Run Program XCOPY c:\test C:\test2 /S /I
XCOPY info, syntax, paramaters:
http://ss64.com/nt/xcopy.html

Re: Copying directories

Posted: Wed Oct 27, 2010 4:21 am
by NickDay
Andy, thank you, that's just what I needed.
It would have been useless if I'd not also been able to use InstallAware variables in the command-line parameters. For example I'm using
"$DocPath$\*.*" "$TARGETDIR$\Documentation" /S /I
which is working fine.
Nick

Re: Copying directories

Posted: Wed Oct 27, 2010 4:25 am
by NickDay
If you can suggest a way to make it not display a CMD window whilst doing the copies, that would be even better.

Re: Copying directories

Posted: Wed Oct 27, 2010 6:48 am
by BobSchaefer
Look at the options in the Run Program window, there should be an option to not display the program output, which should do the trick for you.

Re: Copying directories

Posted: Wed Oct 27, 2010 7:02 am
by NickDay
Stupid of me to miss it. Thanks Bob.
Nick