diff options
author | B. Watson <yalhcru@gmail.com> | 2020-07-05 21:13:12 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2020-07-05 21:13:12 -0400 |
commit | 0af243616ea2870796382d778dc1281121714288 (patch) | |
tree | 84fd73c496b3adb3c3486e8f8754c36c73d12f83 /renumfiles | |
parent | 94ea7a8cd41b5b0cebf2606f4319ca5050e80520 (diff) | |
download | misc-scripts-0af243616ea2870796382d778dc1281121714288.tar.gz |
Minor updates from ~/bin
Diffstat (limited to 'renumfiles')
-rwxr-xr-x | renumfiles | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -16,11 +16,21 @@ if($ARGV[0] =~ /^\d+$/) { } $pattern = $ARGV[0] || usage; -$pattern =~ s/\%d/%02d/; +usage if -f $pattern; + +shift; +if(@ARGV >= 1000) { + $places = 4; +} elsif (@ARGV >= 100) { + $places = 3; +} else { + $places = 2; +} + +$pattern =~ s/\%d/%0${places}d/; if($pattern !~ /\%\d+d/) { - $pattern = "${pattern}_\%02d.jpg"; + $pattern = "${pattern}_\%0${places}d.jpg"; } -shift; @files = @ARGV; usage unless @files; |