Archive: File problems..


File problems..
Hi All,

It was working for me before, but for some reason
I'm getting "bizarre" results when I try to use
"File" to zip-up my source directory. I'm using the latest
NSIS 2.25

These aren't the "real" directory names, I'm just using
them as an example. :-)

C:
Blah
Foo
Bar

I need to zip-up everything in C:\Blah, including the
leading "Blah" directory, and all
it's subdirectories Foo and Bar and all it's files.
But there are other directories named "Blah", backups, nested in backup folders in other directories.

I was using:

File /r "${SOURCE_DIR}"

with "SOURCE_DIR" set to C:\Blah
and it seemed to work for a long time, now it's pulling
in everything from other directories it finds, and I even
tried:

File /r "${SOURCE_DIR}\*.*"

It only pulls in what's in C:\Blah, but when the
installer runs, the subdirectories, and some of the
other data files, come out in a strange order.

I know this is a really basic thing, so exactly what
should I use to zip-up only C:\Blah, including that
directory, and all it's subdirectories, but not any
other Blah directories buried in other places?

Thanks,

Joe Siebenmann


Use:

SetOutPath $INSTDIR\Blah
File /r ${SOURCE_DIR}\*.*
And for the long explanation, see File's documentation.
If the /r switch is used, matching files and directories are recursively searched for in subdirectories. If just one path segment is specified (e.g. File /r something), the current directory will be recursively searched. If more than one segment is specified (e.g. File /r something\*.*), the last path segment will be used as the matching condition and the rest for the directory to search recursively. If a directory name matches, all of its contents is added recursively. Directory structure is preserved.
Note: when using the /r switch, both matching directories and files will be searched. This is always done with or without the use of wildcards, even if the given path perfectly matches one directory. That means, the following directory structure:
<DIR> something
file.dat
another.dat
<DIR> dir
something
<DIR> dir2
file2.dat
<DIR> another
<DIR> something
readme.txt
with the following File usage:
File /r something
will match the directory named something on the root directory, the file named something in the directory named dir and the directory named something in the directory named another. To match only the directory named something on the root directory, use the following:
File /r something\*.*
When adding \*.*, it will be used as the matching condition and something will be used as the directory to search. When only something is specified, the current directory will be recursively searched for every and directory named something and another\something will be matched.

Thanks! It looks like that'll work! :-)