Suponho que isso seja para backup ou similar. Se assim for, eu fiz um arquivo bat e tarefas agendadas é executado uma vez por semana.
Tente criar um arquivo bat.
Abra o bloco de notas e digite
xcopy "file location" "file destination" /i /e /y /z
por exemplo
xcopy "c:\allmusic\mp3\" "e:\music\" /i /e /y /z
Salve o arquivo como .bat (por exemplo, "copyFiles.bat")
Você pode ter várias linhas, mas uma por linha. EG
xcopy "c:\allmusic\mp3\" "e:\music\" /i /e /y /z
xcopy "c:\allmusic\wav\" "e:\music\" /i /e /y /z
xcopy "c:\allmusic\wmv\" "e:\music\" /i /e /y /z
Por favor, note que os /i
/y
/e
e /z
têm significados que podem ser desejáveis ou não (como sobrescrever), veja uma lista aqui:
/A Copies only files with the archive attribute set, doesn't change the attribute.
/M Copies only files with the archive attribute set, turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attribute
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an existing destination file.
/-Y Causes prompting to confirm you want to overwrite an existing destination file.
/Z Copies networked files in restartable mode.
Você também pode usar "mover", que é semelhante ao recortar e colar
por exemplo
mova "fonte" "destino"
move "c:\allmusic\mp3\" "e:\music\" /i /e /y /z
move "c:\allmusic\wav\" "e:\music\" /i /e /y /z
move "c:\allmusic\wmv\" "e:\music\" /i /e /y /z
EDITAR
Para copiar várias pastas fazendo um loop, tente
for /f %%f in ('dir /b c:\') do (
cd\
cd %%f
copy *.mp3 "e:\music"
for /f %%g in ('dir /b %%f') do (
cd\
cd %%g
copy *.mp3 "e:\music"
for /f %%h in ('dir /b %%g') do (
cd\
cd %%h
copy *.mp3 "e:\music"
pause
)
)
)
Note que isso faz 3 níveis de subpastas