首页 > 解决方案 > 排除功能不适用于 xcopy

问题描述

这是我的命令

排除功能不适用于 xcopy

@Echo Off 
set source=C:\Users\garang\Documents\input_files2\Advisory_Rate
set destination=C:\Users\garang\Documents\input_files2\Advisory_Rate\Archive
xcopy "C:\Users\garang\Documents\input_files2\Advisory_Rate" "C:\Users\garang\Documents\input_files2\Advisory_Rate\Archive" /S /C /Y /EXCLUDE:"C:\Users\garang\Documents\input_files2\Advisory_Rate\Advisory Rate mapping.xlsx"

错误:

C:\Users\garang\Documents\input_files2\Advisory_Rate>movefiles 
Can't read file: "C:\Users\garang\Documents\input_files2\Advisory_Rate\Advisory Rate mapping.xlsx" 
0 File(s) copied 
C:\Users\garang\Documents\input_files2\Advisory_Rate> 

这是参考问题,我已经放弃了这个问题。

标签: batch-filecmdwindow

解决方案


RoboCopy也可以移动文件和目录!!

如果您在该特定树中只有一个目录Archive,您可能会使用它:

@CD /D "%UserProfile%\Documents\input_files2\Advisory_Rate" 2>Nul || Exit /B
@RoboCopy . Archive /S /Move /XD "Archive" /XF "Advisory Rate mapping.xlsx" "Quick_OPU_listing.xlsx" 2>Nul

推荐阅读