W
W
Wened2019-06-08 22:13:53
batch processing
Wened, 2019-06-08 22:13:53

Renaming files according to the table of correspondences?

There is an array of files for which there is a table with columns "old name" - "new name", for each unique and the match must be exact. Can you please tell me how to automate renaming using the conditional Total Commander? I found an old question, which mentions the ability to load names from a file in Total Commander, but did not figure out where it is and how to use it.
PS Scripts to write, alas, I do not know how.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2019-06-09
@Wened

Take your table, add one column to the left of your two (old, new) and fill it with the word rename.
ps If the file names contain spaces or characters like slashes, brackets, etc. (not letters and numbers), then each name must be enclosed in double quotes (100 and one way to do this).
Then select all the cells and copy them to the clipboard, then open your favorite text editor and paste the contents of the clipboard there (alternatively, save a csv file or msdos text, experiment).
It should turn out something like:

rename old.txt new.txt
rename old2.txt new.txt
Then save this file under some name with a .bat extension (eg go.bat) or .cmd to the directory where the files are located.
Attention, file encoding must be msdos (cp866) if you have Russian characters in file names. Make sure that it is not unicode, or rather, that your editor does not insert a BOM signature at the beginning of the file, this is not fatal, just the first line will then be erroneous and will be ignored.
That's it, your file renaming program is ready, just run it and your files will be renamed.
If you want to see error messages, add a line with the word to the end of the file in advance,
then the console window will not be closed upon completion and you will see error messages.
If the files are in different directories, then you can specify for each either the full path like c:\temp\zzz.txt or the relative temp\aaa.zzz in this case, go.bat should be placed in this initial directory, where all the others are located.
If the first word on the line is move instead of rename, then this program will move the file from the old location to the new one, and copy will copy it, and in both cases, only the target directory can be specified instead of the new file name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question