
You could filter by file type (ex: add grep mp3 to only choose mp3 files) or you could, after you're done with the above process, write cat rename.sh undo.sh to create a script called "undo.sh" that you can run to undo all of your renames.Īs always, command line stuff looks tedious, but it can save you a ton of time, especially when you're dealing with text, like in this case. From there, you just edit the second "filename.txt" in each line to whatever you want to rename to and then run the script.ĭoing it with the command line makes it easy to get even fancier. That would create a file called rename.sh with a line for every file in that folder formatted like "mv filename.txt filename.txt". Open Bash and navigate to the folder with the files you want to rename.
EASY RENAME FILES WINDOWS
I'm assuming OP doesn't have this feature turned on and wouldn't want to bother doing so, but I figure it's worth at least noting for people that Windows can do this kind of linux sorcery now too. Personally, I have Windows Subsystem for Linux turned on, so I'd do it the Linux way. Not only is something like this probably the fastest way, but it also gives you a way to reverse the process or look up the old filenames if you screw up. This will set your script policy back to its default. Once the name is selectedif you’re renaming a file, not the file extensionyou can start to type a new name. Click on a file or folder to select it, and click Rename from the Home menu at the top of File Explorer.

Once you're done, I recommend running the following command (as administrator): Set-ExecutionPolicy Restricted -Force Select the file that you want to rename and then right click there will be a rename option you can change from there or simply select the file and press F2. Fire up File Explorer by pressing Windows+E, and navigate to a directory with either a file or folder to rename. If you're tight on space, you'll need to delete those originals yourself, as I don't hand out scripts capable of deleting files. renamed files so you aren't repeating anything. If you close the script and run it again, it will ignore all those. What it'll do is present you with the name of the file you're about to rename, ask you for that name, and then it will created a copy of that file with the new name in a new folder called 'Renamed' and add a '.renamed' extension to the original. Since you say you have thousands of files, I've added a bit in to make it easier to resume renaming if you need to take a break. Then you can drag and drop the script onto the PowerShell window and hit enter to start it. Then you'll need to open PowerShell as administrator and run the following command: Set-ExecutionPolicy Unrestricted -Force You'll need to use Notepad to edit the $originalFilesDirectory line to match where the files you want to rename are located.

I don't know of any programs that'll do this, so the best way I can think of for this is a PowerShell script.
