in reply to Renaming Every File in a directory
Hello Rich,
Can you point me in the right direction?
P.S. Always code with use warnings as well as use strict.
Update: Example use of String::Random:
use strict; use warnings; use String::Random; my $oldfile = 'picture.jpg'; my $random = String::Random->new; if ($oldfile =~ /\.jpg$/) { my $oldname = $oldfile =~ s/\.jpg$//r; my $newfile = $random->randpattern('.' x length $oldname) . '.jpg' +; print "$oldfile will be renamed $newfile\n"; }
Example output:
14:18 >perl 1230_SoPW.pl picture.jpg will be renamed O^aK&!R.jpg 14:19 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Renaming Every File in a directory
by Anonymous Monk on Apr 28, 2015 at 04:14 UTC | |
by Athanasius (Archbishop) on Apr 28, 2015 at 04:40 UTC |