x递归地复制目录和子目录并按扩展名仅过滤文件名
这是我现在所拥有的:
xcopy "c:\projects\SampleProject" "c:\temp\copytest" /E /H /EXCLUDE:elist.txt
它可以完成我需要的所有工作,除了按扩展名过滤文件名之外。
例如:复制 c:\temp\copytest
及其子目录中的所有 *.exe
文件。
怎么做呢?
Here is what i have for now:
xcopy "c:\projects\SampleProject" "c:\temp\copytest" /E /H /EXCLUDE:elist.txt
It does all the job i need except filtering filenames by extensions.
For example: copy all *.exe
files from c:\temp\copytest
and subdirectories.
How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我碰巧也需要这个,并发现如果您想将特定类型的文件复制到一个新文件夹,保持当前文件夹结构,您只需要这样做
文档
I happened to need this too, and found out that if you want to xcopy files with specific type to a new folder keeping the current folder structure you need only to do this
Documentation
类似于:
请参阅 (http://technet.microsoft.com/en-us /library/bb490909.aspx)
Something like:
See (http://technet.microsoft.com/en-us/library/bb490909.aspx)
我需要相同的过程(使用排除过滤器复制文件夹)并使用@pollirrata 的示例。
我必须提到的一件事是,为了复制文件夹,我需要为目标目录指定反斜杠以禁止提示问题。
因此,我以以下语法结束:
exclude.txt
文件的内容:要仅复制具有特定扩展名的文件(例如
*.exe
),我使用了I needed the same procedure (copy folders with exclude filter) and used the example of @pollirrata.
One thing I have to mention that in order to copy a folder I needed to specify a backslash for destination directory to suppress prompting a question.
So I ended with the following syntax:
Contents of the
exclude.txt
file:To copy only files with specific extension (e.g.
*.exe
) I used