I love using my own pictures in the built in screensaver, but I got sick of seeing the same order of the pictures. So, I wrote the following perl script to attach a pseudorandom number before the file names in the selected folder. The script assumes it is being run from inside a folder with all your images (no subfolders) that are named *.jpg -- it checks to see if they have a two-digit number, underscore prefix, and adds them if necessary. Otherwise it changes the number to a new value. Run as often as you like or have cron do it.
Read the rest of the article for the script...
Read the rest of the article for the script...
#! /usr/bin/perl -w[Editor's note: Any typos in the above are probably my fault ... let me know if something appears incorrect as I have not tested this myself!]
srand;
foreach $file () {
if ($file !~ /^[0-9]+_/ ) {$pref=int rand(100); $new=$pref."_".$file; rename ($file, $new);}
elsif ($file =~ /^[0-9]+_/) {$pref=int rand(100); $_=$file; s/[0-9]+_/$pref_/; rename ($file, $_);}
}
•
[3,332 views]

