NSIS - How to copy recursively while excluding files?
Asked Answered
C

1

10

I need to copy a directory recursively but exclude a couple of directories within it.

The documentation for NSIS says the File command takes /r and /x parameters, but I cannot get them to work together properly.

The structure of my directory containing my .nsi script is:

parent-dir
    dir-to-exclude-1
        setup.nsi
    dir-to-copy-1
    dir-to-copy-2
    dir-to-copy-3
    dir-to-exclude-2

And I've tried the following, but it's not working for me:

SetOutPath $INSTDIR
File /r "..\**" /x "..\dir-to-exclude-1\**" /x "..\dir-to-exclude-2\**"  

Thanks in advance for any help.

Edit: I'm getting closer, so now I have:

File /r /x \dir-to-exclude-1\*.* /x \dir-to-exclude-2\*.*  ..\*

Now it will compile and install all the files, but without excluding the directories I want. Any guidance for how I can exclude these?

Crash answered 14/7, 2010 at 19:25 Comment(0)
C
5

Figured it out with the help of a coworker. Just give the directory names without any *'s:

File /r /x dir-to-exclude-1 /x dir-to-exclude-2 /x installer  ..\*
Crash answered 14/7, 2010 at 20:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.