Reputation: 3553
I can't seem to find any information about how to copy a directory using NSIS ?, i know there is a file command but is there any command to copy a directory .
Upvotes: 29
Views: 26528
Reputation: 1
The star to match the whole content after the back slash is mandatory. The syntax is the following.
See the manual section 4.9.1.6
SetOutPath "outputPath\myDirectory"
File /nonfatal /a /r "myDirectory\*"
Upvotes: 0
Reputation: 73301
The syntax is same for both directory and file, except that you need to specify a directory by providing a \
at the end. File
command copies the directory if the specified argument is a directory. For eg, you can do:
SetOutPath "outputPath"
File "myDirectory\" #note back slash at the end
But that copies only the top level directory. To recursively do it, you have /r
switch
SetOutPath "outputPath"
File /nonfatal /a /r "myDirectory\" #note back slash at the end
which copies the contents of myDirectory
(but not myDirectory
folder itself). /nonfatal
ignores without an error if there is no particular directory. /a
copies file attributes as well. /x
switch is used to exclude files.
Otherwise,
SetOutPath "outputPath\myDirectory"
File /nonfatal /a /r "myDirectory\" #note back slash at the end
copies all the contents of myDirectory
including myDirectory
folder to outputPath
.
Upvotes: 42
Reputation: 101764
The File
instruction extracts files from your installer and CopyFiles
copies files and/or directories that already exist on the end-users system (You can use $EXEDIR if you need to copy files off a dvd where your installer is also located...)
Upvotes: 3
Reputation: 3553
I found how to do it , sorry for the trouble .
Extract the files to a directory which can't exist beforehand
CreateDirectory $Installdir\extracting
SetOutPath $Installdir\extracting
File Directory\*
Upvotes: 5