简体   繁体   English

NSIS - 如何在排除文件的同时递归复制?

[英]NSIS - How to copy recursively while excluding files?

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. NSIS的文档说File命令采用/r/x参数,但我无法使它们正常工作。

The structure of my directory containing my .nsi script is: 包含我的.nsi脚本的目录结构是:

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? 有关如何排除这些内容的任何指导?

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  ..\*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM