Copy files to NSIS

I use the following command to copy files.

After setting the output path ...

File "Documents\*" 

This action works flawlessly. No problem copying files in the Documents directory so far ...

if the directory contains a copy of an existing file (with a different name), only the first copy of the file is copied regardless of the name.

How can I make it copy ALL files regardless of whether they are copies of other files?

Correction / best explanation (possible)

I apologize for the confusion. Let me try to repeat the problem. Files retrieved using the FILE command are the problem here. Files consist of original files and copies of the same files (with a different name only).

example: MyDocument.txt and copyOfMyDocument.txt, etc.

When the File command is used to extract files to the current output path, only the first file instance is retrieved (either a copy or the original ... but not both). Again, I apologize for the embarrassment, but this is the first time I have had to work with NSIS. I need to extract ALL files.

+4
source share
2 answers

The easiest way to do this is to put it in another directory that you created. Then, if you need to worry about renaming (since commentators have noted that your question doesn’t make much sense), you can attack it file by file.

 # Extract the files to a directory which can't exist beforehand CreateDirectory $PLUGINSDIR\extracting SetOutPath $PLUGINSDIR\extracting File Documents\* # Now go through file by file FindFirst $0 $1 $OUTDIR\* ${While} $1 != "" ${If} ${FileExists} $DOCUMENTS\$1 # This still isn't infallible, of course. Rename $DOCUMENTS\$1 $DOCUMENTS\$1.local-backup ${EndIf} Rename $OUTDIR\$1 $DOCUMENTS\$1 FindNext $0 $1 ${Loop} FindClose $0 SetOutPath $INSTDIR # Or somewhere else RMDir $PLUGINSDIR\extracting 

(Note that using LogicLib.)

This is not a very convenient way to do this, and if you can avoid it, do it.

+3
source

I thought I understood what you were after, until I started reading the answers; I will go with my initial interpretation: given the directory called "Documents", with a bunch of files in it (what they call and their contents should not matter), you want the installer to copy the files to some output directory. I created a test installer for this scenario here , and it works for me. What am I missing in what are you after?

+1
source

All Articles