Here’s a magic-trick I rock from time to time. I only graze the basic abilities of the “rename” program, but even in my basic use of it, I find it super helpful.
In this case, I had a situation where my eBooks had been resorted from a massive flat directory in to one containing sub-dirs named with the prefix “Categories – “. I might have sorted them in another manner if I didn’t know about the rename command. When I was done sorting and thus left with my category-based directories, I then wanted to rename each dir to dump the prefix.
A simple call to rename is all it takes:
rename "s/[what to find]/[what to replace it with]/" *
In that above case, I feed rename a listing of everything in the current working directory since I ended the command with a star. Anyway, I’m glossing over a lot of details as this isn’t meant to teach about the command-line, regular expressions or much else. My point here is simply that this ‘rename’ program is awesome and I adore using it.
macOS users can install it through homebrew:
brew install rename.
Linux/BSD users can typically install rename via their package managers, such as:
sudo apt install rename
Windows 10 users can get it through the Linux subsystem, if you enable it and then install it like illustrated above.