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 .
To copy files or directories in Unix-based operating systems (Linux and MacOS), you use the cp command. The cp command is a relatively simple command, but its behavior changes slightly depending on the inputs (files vs directories) and the options you pass to it.
Copy a Directory and Its Contents ( cp -r ) Similarly, you can copy an entire directory to another directory using cp -r followed by the directory name that you want to copy and the name of the directory to where you want to copy the directory (e.g. cp -r directory-name-1 directory-name-2 ).
You can copy files by right-clicking on the file and selecting "Copy", then going to a different directory and selecting "Paste". For my terminal friends, you can also perform file copy-paste operations without leaving the terminal. In a Linux-based terminal, you do this using the cp command.
Copying Directories with cp Command To copy a directory, including all its files and subdirectories, use the -R or -r option. The command above creates the destination directory and recursively copy all files and subdirectories from the source to the destination directory.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With