I have a folder containing thousands of files:
file1.jpeg
file2.jpeg
file3.jpeg
etc.
I have a text file containing a list of new filenames I want to substitute:
old_filename new_filename
file3.jpeg my_dog.jpeg
file1.jpeg my_cat.jpeg
file2.jpeg my_goat.jpeg
etc.
I am looking for a script to rename all the files in the folder using the new filenames (or append the new name as a prefix to the original filename).
I think I need something that will search the folder, compare the name to the text file and then rename the file accordingly.
The lists and files are not sorted in any way.
mv
to every line in your file that you can pipe to your shell?sed -n '2,$ p' <your_file> | sed 's/^/mv /' | bash