Random file names

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Random file names

Postby Bryan » Sat Dec 24, 2005 4:07 pm

It would be cool, if the programme could generate random file names for files in a particular folder; bassed on given perameters
Bryan
 
Posts: 3
Joined: Sat Dec 24, 2005 4:05 pm
Location: London, UK

Postby spambait » Tue Jan 03, 2006 5:17 pm

You wouldn't be contemplating a spam attack would you? :wink:

Seriously though, I don't understand how this feature would be useful.
spambait
 
Posts: 16
Joined: Tue Jan 03, 2006 5:06 pm

Postby Stefan » Wed Jan 04, 2006 4:39 pm

spambait wrote:Seriously though, I don't understand how this feature would be useful.


Maybe

for security:
randomize your files, than delete them with Shift+Del,
than wipe the free space of your disc.
('cus recovery software can smt still recover the file name)

for security:
randomize the name of your allready encrypted files
to better hide them

or for fun:
randomize your MP_3 files, than listen and be surprised :D
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Random file names

Postby tjd » Tue Jan 15, 2008 7:15 am

I've got a use for this feature... I got a digital photo frame as a gift but the "random slideshow" feature seems to be broken - it only shows the pictures in filename order. So, I thought randomly renaming the pictures was at least a partial workaround...

In case this dubious "feature" never makes it into BRU and someone else looking to do this happens to stumble upon this post, here's a perl script I hacked together in 5 minutes. It's not even close to being general purpose, it just takes a bunch of files named 'pXXXXX.jpg' and renames them to 'rXXXXX.jpg' where the 'XXXXX' parts are randomly transposed. I got the "shuffle" part from the perl FAQ.

Code: Select all
#! /usr/bin/perl

# randomize the filenames for the photo frame

$dir = $ARGV[0] || die "directory?\n";
chdir($dir) || die "chdir";

opendir(D, ".") || die "opendir";
@files = grep {/jpg/} readdir(D);
closedir(D);

# array shuffle from perl FAQ
srand;
@newfiles = ();
for (@files) {
    my $r = rand @newfiles + 1;
    push(@newfiles,$newfiles[$r]);
    $newfiles[$r] = $_;
}

if ($#files != $#newfiles) { die "$#files != $#newfiles\n"; }

while ($old = pop @files) {
    $new = pop @newfiles;
    $new =~ s/^p/r/;
    ! -f $new || die "won't overwrite $new - check the regexp\n";
    print "$old -> $new\n";
    rename $old, $new || warn "rename $old -> $new: $!\n";
}
tjd
 
Posts: 2
Joined: Tue Jan 15, 2008 3:54 am

Re: Random file names

Postby BRUFolio » Tue Jan 15, 2008 12:22 pm

I have several times needed a feature like this.
BRUFolio
 
Posts: 45
Joined: Tue Feb 21, 2006 12:05 pm

Re: Random file names

Postby Admin » Tue Jan 15, 2008 1:45 pm

Just sort the files randomly and add an autonumber prefix, that will achieve the same result.


Jim
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Random file names

Postby BRUFolio » Tue Jan 15, 2008 2:14 pm

How would you do a random sort?
I have sorted by size an that would appear to be somewhat random, but not quite enough in some cases....
BRUFolio
 
Posts: 45
Joined: Tue Feb 21, 2006 12:05 pm

Re: Random file names

Postby BRUFolio » Tue Jan 15, 2008 2:19 pm

oops! I see you have it in BRU. Never noticed that before.

that would accomplish it.

it is always nice to have a requested feature already built in before they ask for it,,,,,
BRUFolio
 
Posts: 45
Joined: Tue Feb 21, 2006 12:05 pm

Re: Random file names

Postby tjd » Wed Jan 16, 2008 10:38 pm

thanks - completely missed the 'random sort' but that will indeed work fine.
tjd
 
Posts: 2
Joined: Tue Jan 15, 2008 3:54 am

Re: Random file names

Postby Henrik » Wed Dec 31, 2008 10:05 am

Sorry - missed the answer from Jim (took a while to find the function since "sort" is both under "Options" and under "Actions".

The solution works great!

Henrik
Henrik
 
Posts: 1
Joined: Wed Dec 31, 2008 9:54 am


Return to Suggestions