slitaz-dev-tools diff baba-scripts/rename.pl @ rev 195
Add Russian translation to desktop files
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Apr 26 14:13:28 2013 +0000 (2013-04-26) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/baba-scripts/rename.pl Fri Apr 26 14:13:28 2013 +0000 1.3 @@ -0,0 +1,22 @@ 1.4 +#! /usr/bin/perl 1.5 +$testmode = 0; #false 1.6 +if ($ARGV[0] eq '-t') { 1.7 + $testmode = 1; #true 1.8 + shift; 1.9 +} 1.10 +($regexp = shift @ARGV) || die "Usage: rename [-t] perlexpr [filenames]\n-t : option to test action (nothing really done)\n"; 1.11 +if (!@ARGV) { 1.12 + @ARGV = <STDIN>; 1.13 + chomp(@ARGV); 1.14 +} 1.15 +print "Test mode\n" if ($testmode); 1.16 +foreach $_ (@ARGV) { 1.17 + $old_name = $_; 1.18 + eval $regexp; 1.19 + die $@ if $@; 1.20 + unless ($old_name eq $_) { 1.21 + print "$old_name -> $_\n"; 1.22 + rename($old_name, $_) unless $testmode; 1.23 + } 1.24 +} 1.25 +exit(0);