I have the following file structure:
- Some directory
- Some file.txt
- Another file here.log
- Yet another file.mp3
- Another directory
- With some other file.txt
- File on root level.txt
- Another file on root level.ext
What I want to do now is run a little script that takes another file as input containing some type of pattern/replacement pairs in it to rename these files recursively according to them. So that every "another" (case insensitive) gets replaced with "foo" or every "some" with "bar."
I already tried a lot of things with iterating over files and reading said input file, but nothing worked like it should and I finally managed to accidentally overwrite my testing script. But there were a lot of
mv in use.
The two things I couldn't resolve myself were how to handle whitespace in filenames and how to not handle files that were already renamed in a previous pattern match.
Maybe you can point me in the right direction?