Mass File/Folder Renamer and Un-Renamer?

Bulk Rename Utility How-To's

Mass File/Folder Renamer and Un-Renamer?

Postby katenecon58 » Sat Jan 23, 2021 11:00 am

Some folders/files I'd like to upload to cloud storage. But I don't really want some of them flagged because of their names (my music or movies, for example, because of some laws somewhere could be considered copyrighted and therefore deleted).

Is there a utility that can mass rename files and folders to something random, but keeps a list of their original names and new names (and possibly filesize/hashsum to verify)? Then when you download them again and you run the utility it would check that file and, if it exists in the list, rename them back to their original names?

I'm sure this could be done with a fairly simple script, but I would have to research how and thought I would check with you all and see if a tool like this already exists. I'm using Linux.

Thanks for anyone who can help or point me in the right direction.
katenecon58
 

Re: Mass File/Folder Renamer and Un-Renamer?

Postby Luuk » Sun Jan 24, 2021 2:20 am

Greetings katenecon58. Im not know of any utility that does all of this automatically. If its me, Im probably decide with the exiftool.exe, because it can store the csv databases with filesize/hashsum/original-name/etc, but also it can just store the original-names inside the files as $Metadata. This just some examples...

For all mp4s, store original-name inside $PreservedFileName, then rename to random 9characters (7uppercases,2digits)
Code: Select all
exiftool -ext mp4 -overwrite_original -PreservedFileName"<FileName" -FileName"<${Filename;my $x;$x.=['A'..'Z']->[rand 26] for 1..7;$x.=[0..9]->[rand 10] for 8..9;$_=$x}.%le" "YourFolderPath"
Then after downloading the .mp4s again, to restore all of the original-names...
Code: Select all
exiftool -ext mp4 -overwrite_original -FileName"<PreservedFileName" "YourFolderPath"

Its ok adding more extensions with -ext or -r to recurse all of the folders, but depending on your filetypes, you also maybe want to put original-names inside another $Metadata, but the exiftool forum is best place for that kind of support.
Luuk
 
Posts: 704
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To