Copying directories

Got a problem you cannot solve? Try here.
Post Reply
NickDay
Posts: 145
Joined: Tue Oct 05, 2010 9:13 am

Copying directories

Post 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
dunion
Posts: 106
Joined: Tue Oct 14, 2008 10:43 am

Re: Copying directories

Post 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$
mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Copying directories

Post 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.
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
NickDay
Posts: 145
Joined: Tue Oct 05, 2010 9:13 am

Re: Copying directories

Post 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
NickDay
Posts: 145
Joined: Tue Oct 05, 2010 9:13 am

Re: Copying directories

Post 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?
mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Copying directories

Post 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
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
NickDay
Posts: 145
Joined: Tue Oct 05, 2010 9:13 am

Re: Copying directories

Post 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
NickDay
Posts: 145
Joined: Tue Oct 05, 2010 9:13 am

Re: Copying directories

Post 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.
BobSchaefer
Posts: 47
Joined: Thu Sep 30, 2010 12:12 pm

Re: Copying directories

Post 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.
NickDay
Posts: 145
Joined: Tue Oct 05, 2010 9:13 am

Re: Copying directories

Post by NickDay »

Stupid of me to miss it. Thanks Bob.
Nick
Post Reply