我想使用 robocopy 移动大量文件,但白名单中的文件除外。白名单包含大约 150 个不同名称的文件。当我将白名单的文件名复制并粘贴到命令行中(使用/xf参数)时,robocopy 会截断列表。
c:\test> robocopy src dest *.ext /xf exclude1.ext exclude2.ext exclude3.ext ... exclude 299.ext exclude300.ext
Run Code Online (Sandbox Code Playgroud)
结果是:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Fri May 24 14:09:31 2013
Source : C:\test\src\
Dest : C:\test\dest\
Files : *.ext
Exc Files : exclude1.ext
exclude2.ext
exclude3.ext
....
....
exclude200.ext
exclude201.ext
exclu
Run Code Online (Sandbox Code Playgroud)
进而:
'exclude250.ext' is not recognized as an internal or external command,
operable program or batch file.
'exclude251.ext' is not recognized as an internal or external command,
operable program or batch file.
'exclude252.ext' is not recognized as an internal or external command,
operable program or batch file.
'exclude253.ext' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
不幸的是,白名单中的文件是手工挑选的,不能通过通配符过滤。
有没有办法解决这个问题?
Fal*_*mot 13
Windows 中的命令行长度有限制(我认为它类似于 2048 个字符)。
您应该生成一个作业文件,其中指定了排除列表的一小部分(使用/save:filename参数)以获取语法,编辑文件以包含完整列表,然后使用/job:filename参数运行它。
| 归档时间: |
|
| 查看次数: |
34130 次 |
| 最近记录: |