Search code examples
batch-filecopyxcopyrobocopy

copy file with specific names batch


How can I copy files with a specific name with a batch file?

XCOPY and ROBOCOPY has no right key for it.

I tried something like this

ROBOCOPY %path_to_server% %collected_data_folder% /S /XC /XN /XO

but it copies ALL files. I want to copy just the files with "_CPU2" in their names.


Solution

  • ROBOCOPY %path_to_server% %collected_data_folder% *_CPU.* /S /XC /XN /XO

    just added the *_CPU.* after your destination path