Tuesday, February 13, 2018

batch - Copy list of files to new names

Windows 7 Pro


I want to copy a series of files, all named "cover" from different directories to a single directory, and give them all new names. I need help with either of the below options:


Option 1
Use a batch file to copy the source files to a single directory as "cover1", "cover2", etc., then rename by hand.


I can use the below one-line batch file, but it copies files sequentially to the name "cover" in the directory "A", resulting in just one final file.


for /f "delims=" %%L in (Coverscopy.txt) do copy "%%L" A

I presume I should use a loop to add a number to the filename, but I'm afraid I don't seem to know how to vary the file name with each cycle.


Second option
Use a batch filed that draws from a CSV file with columns for the original file address and the desired new name.


Unfortunately, I have no idea where to start with this.


Any assistance appreciated.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...