I regularly need to copy and rename files whose filenames have various lengths but always end in the same three characters, which I need to change to another three characters.
For example, if the source files have the names "ABC123BananaAB1.txt" and "DEF345PineappleAB1.docx", then I need to copy them to target files with the names "ABC123BananaXYZ.txt" and "DEF345PineappleXYZ.docx" respectively. In other words, I need the target filenames to be the same as the source filenames but with the last three characters changed from "AB1" to "XYZ".
I tried using a bat file containing the command "copy *AB1.* *XYZ.*", but it didn't work properly. How can I get this to work?
#1. "RE: Batch file to copy and rename files" In response to harry (Reply # 0) Thu Feb-25-21 02:19 PM by Paul D
Bulk Rename Utility will do that for you, and much more besides. I've used it for years, and it's absolutely free. I'm assuming the files to be changed are in the same folder, as the software's major limitation is that it can only work in one folder at a time.
#3. "RE: Batch file to copy and rename files" In response to Paul D (Reply # 1)
QUOTE: Bulk Rename Utility will do that for you, and much more besides. I've used it for years, and it's absolutely free. I'm assuming the files to be changed are in the same folder, as the software's major limitation is that it can only work in one folder at a time.
Paul D Thanks for this. I always like it when there is a portable version. BTW in the current version you can specify sub-directories so with a bit of moving folders around you could scan more than one folder's files.
#4. "RE: Batch file to copy and rename files" In response to therube (Reply # 2)
Thanks for your replies. It appears that the Batch Rename Command utility will do part of what I need, but it appears that I still need an additional command to make a copy, because I want to end up with the original file AND a renamed copy.
Example:
1. Start with one file ("ABC123BananaAB1.txt"). 2. Run batch file to copy/rename. 3. End up with two files ("ABC123BananaAB1.txt" AND "ABC123BananaXYZ.txt").
#5. "RE: Batch file to copy and rename files" In response to harry (Reply # 4) Fri Mar-12-21 03:00 PM by Paul D
Open relevant folder Select files to copy/rename. Ctrl~C Ctrl~V (in the same folder) You will then have your original and copy files, named FilenameABC.aaa and FilenameABC- Copy.aaa respectively. Using BRU, rename all the "- Copy" files as required.
#6. "RE: Batch file to copy and rename files" In response to Paul D (Reply # 5) Mon Mar-15-21 11:01 PM by harry
Thanks for your reply. A batch file containing the following command does the renaming OK, after using Ctrl+C & Ctrl+V to copy and paste the source file manually.
brc64.exe /execute /replaceci:"AB1 - Copy":XYZ
Is it possible to include a command in the batch file to do automatically what Ctrl+C & Ctrl+V does manually; i.e., to copy *AB1.* to *AB1 - Copy.*?