windows - Using Xcopy or other to copy similar folders within directory -
i have 1 directory several folders names 'mapas_10452; mapas_21685; mapas_22731' , os on... inside every folder have several folders, want copy contents of 1 of them, folder 'novos'.
is possible use xcopy, batch file or other option copy contents of folder want, evey folder 'mapas_xxxxx' have ?
the result be: mapas_10452/novos mapas_21685/novos mapas_22731/novos
- as
for /?
says should put path in parentheses. - add wildcard enumerate folder contents:
*
- use name of parent folder construct new path:
%%~nf
- check if
novos
subfolder exists. - for flexibility use
%userprofile%
system variable - use
xcopy /s
, add trailing slash second argument indicate it's folder - [optional] use doubleqoutes process file/folder names spaces
for %%f in ("%userprofile%\desktop\mapassaas\*") ( if exist "%%f\novos" ( xcopy /s "%%f\novos" "%userprofile%\desktop\folder\%%~nf\novos\\" ) )
Comments
Post a Comment