[英]Using Xcopy or other to copy similar folders within directory
I have one directory with several folders with names like 'MAPAS_10452; 我有一个目录,其中包含几个名为'MAPAS_10452的文件夹; MAPAS_21685; MAPAS_21685; MAPAS_22731' and os on... Inside every folder I have several folders, but I just want to copy the contents of one of them, the folder 'NOVOS'. MAPAS_22731'和操作系统...在每个文件夹中,我都有几个文件夹,但是我只想复制其中一个文件夹“ NOVOS”的内容。
Is it possible to use Xcopy, batch file or other option to copy just The contents of the folder I want, for evey folder 'MAPAS_XXXXX' I have ? 是否可以使用Xcopy,批处理文件或其他选项来仅复制我想要的文件夹的内容(对于我拥有的evey文件夹“ MAPAS_XXXXX”)?
The result would be: MAPAS_10452/NOVOS MAPAS_21685/NOVOS MAPAS_22731/NOVOS 结果将是:MAPAS_10452 / NOVOS MAPAS_21685 / NOVOS MAPAS_22731 / NOVOS
for /?
至于for /?
help says you should put the path in parentheses. 帮助说您应该将路径放在括号中。 *
添加通配符以枚举文件夹内容: *
%%~nf
仅使用父文件夹的名称来构造新路径: %%~nf
NOVOS
subfolder actually exists. 检查NOVOS
子文件夹是否实际存在。 %USERPROFILE%
system variable 为了灵活%USERPROFILE%
使用%USERPROFILE%
系统变量 xcopy /s
and add a trailing slash to the second argument to indicate it's a folder 使用xcopy /s
并在第二个参数后添加斜杠以指示它是文件夹 for %%f in ("%USERPROFILE%\Desktop\MapasSAAS\*") do (
if exist "%%f\NOVOS" (
xcopy /s "%%f\NOVOS" "%USERPROFILE%\Desktop\folder\%%~nf\NOVOS\\"
)
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.