XCOPY to move and rename files
Search

XCOPY to move and rename files


The Tip of the Night for May 8, 2018, discussed how to use XCOPY in a batch file to both copy files to a new location and rename them. Here's another approach.

If this format is used, with the XCOPY command simply followed by the current path of the files and then the new path with the new name:

XCOPY "C:\FooFolder\beer\DOC\042611 Computer Forensic Expert.doc" "C:\FooFolder\Chicago\Report1.doc" XCOPY "C:\FooFolder\beer\DOC\AIPLANewsletterMarch2005.doc" "C:\FooFolder\Chicago\Report2.doc" XCOPY "C:\FooFolder\beer\DOC\Budget Cut Memo - AS - v2.doc" "C:\FooFolder\Chicago\Report3.doc" XCOPY "C:\FooFolder\beer\DOC\Budget Cut Memo - AS.doc" "C:\FooFolder\Chicago\Report4.doc" XCOPY "C:\FooFolder\beer\DOC\Do You Have The Time_master.doc" "C:\FooFolder\Chicago\Report5.doc" XCOPY "C:\FooFolder\beer\DOC\Proposed_ED_Rules_and_Standards_2004.doc" "C:\FooFolder\Chicago\Report6.doc" XCOPY "C:\FooFolder\beer\DOC\Sample NonCompet Agreement Assign1B.doc" "C:\FooFolder\Chicago\Report7.doc" XCOPY "C:\FooFolder\beer\DOC\sanctions_chart.doc" "C:\FooFolder\Chicago\Report8.doc" XCOPY "C:\FooFolder\beer\DOC\TwitterArticle.doc" "C:\FooFolder\Chicago\Report9.doc" XCOPY "C:\FooFolder\beer\DOC\WDPAApplicationforAppointmentasE-DiscoverySpecial Master.doc" "C:\FooFolder\Chicago\Report10.doc"

. . . you will be prompted to specify if the target is a file or directory.

The script stalls out and you need to respond for each line of code.

You can get around this problem by changing the beginning of each line to:

echo F|xcopy /S /Q /Y /F

The /S switch will account for subfolders. /Q hides the file names during the copying process. /Y will overwrite any existing files. /F will display the file name used in the destination.


Contact Me With Your Litigation Support Questions:

seankevinoshea@hotmail.com

  • Twitter Long Shadow

© 2015 by Sean O'Shea . Proudly created with Wix.com