How do i mass-rename files to random names?

Post any Bulk Rename Utility support requirements here. Open to all registered users.

How do i mass-rename files to random names?

Postby Das_Unterstrich » Sat Oct 02, 2021 10:14 am

I basically have a lot of pngs with names like
    image1.png | 2021-09-01.png | 172612.png | etc
and would like to rename them all to having 5 random characters, for example
    utOgK.png | bt9u7.png | WrCcr.png
I looked through the manual and some forum posts already, but didn't really find any way to do it. Am I just overlooking something?
Das_Unterstrich
 
Posts: 2
Joined: Sat Oct 02, 2021 9:39 am

Random rename from a custom list of characters

Postby Luuk » Sun Oct 03, 2021 2:16 am

With having the paid version, javascript can choose random-characters from inside a custom-list like...

if (/png/i.test(ext)) {
function random() {
string = ''
list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
for (var i=0; i<5; i++) {string += list.charAt(Math.random()*list.length)}
return string}
newName = random()}

If needing to save the original-names inside of the metadata, Im often use the exiftool.exe to conduct this instead.
But also after renaming, the bulk rename utility grants "Actions, Create Undo Batchfile" to help restore the original-names.
Luuk
 
Posts: 359
Joined: Fri Feb 21, 2020 10:58 pm

Re: How do i mass-rename files to random names?

Postby Das_Unterstrich » Sun Oct 03, 2021 11:11 am

Okay thanks, but well no real solution for me because I don't have a commercial license.
Das_Unterstrich
 
Posts: 2
Joined: Sat Oct 02, 2021 9:39 am

Random rename from a custom list of characters

Postby Luuk » Sun Oct 03, 2021 10:31 pm

This some different ways to experiment the same with having the free exiftool.exe, but its a command-line application!...

exiftool -ext png -fast4 -Testname"<${Filename;my $x;$x.= ['A'..'Z','a'..'z',0..9]->[rand 62] for 1..5;$_=$x}.png" "C:/Your/Folder/Path"
Conduct all .png files inside 'C:/Your/Folder/Path' without saving the original-names.

exiftool -r -ext png -fast4 -Testname"<${Filename;my $x;$x.= ['A'..'Z','a'..'z',0..9]->[rand 62] for 1..5;$_=$x}.png" "C:/Your/Folder/Path"
Cconduct all .png files at or below 'C:/Your/Folder/Path' without saving original-names.

exiftool -r -ext png -overwrite_original -Testname"<${Filename;my $x;$x.= ['A'..'Z','a'..'z',0..9]->[rand 62] for 1..5;$_=$x}.png" -Document"<Filename" "C:/Your/Folder/Path"
Conduct all .png files at or below 'C:/Your/Folder/Path' while saving the original-names inside of each file's $Document metadata.

Each command will only present a preview looking like... "Path/OldNames.png" --> "Path/NewNames.png".
So if ready and wanting to rename the files, you can then just change -Testname ===> -Filename.

The -fast4 tells exiftool.exe to not conduct any metadata, so then -overwrite_original isnt needed, because its just renaming files.
The -r does just say "recurse all folders", but there is also many other ways to only conduct certain sub-folders or files.
Luuk
 
Posts: 359
Joined: Fri Feb 21, 2020 10:58 pm

Re: How do i mass-rename files to random names?

Postby Admin » Tue Oct 05, 2021 3:14 am

You could export your file list to CSV (select all the files to rename in the BRU list and right-click and then "Clipboard Copy") then paste them into Excel or another spreadsheet software. Then create random files with the spreadsheet software and export to CSV and import CSV into BRU to rename.
Admin
Site Admin
 
Posts: 2085
Joined: Tue Mar 08, 2005 8:39 pm


Return to BRU Support