|
#!/usr/bin/perl
#use Time::localtime;
my ($ss,$mm,$hh,$dd,$MM,$YY)=localtime;
print sprintf("%02d.%02d.%02d_%02d:%02d:%02d\n",
$YY-100,$MM+1,$dd,$hh,$mm,$ss);
#-----------------------------------------------------#
#!/usr/local/bin/perl
foreach $f (`ls *.*`) {
chomp($f);
$g=$f;
$g=~s/^[\.\sa-zA-Z_-]+//g;
$g=~s/[\.\sa-zA-Z_-]+$//g;
@s=split(/[\.\sa-zA-Z_-]+/,$g);
@t=();
foreach $a (@s) {
$l=length($a);
@b=split(//,$a);
if($l==2) { push(@t,$a);}
elsif($l==4) { push(@t,"$b[2]$b[3]");}
elsif($l==6) { push(@t,"$b[0]$b[1]","$b[2]$b[3]","$b[4]$b[5]");}
elsif($l==8) { push(@t,"$b[2]$b[3]","$b[4]$b[5]","$b[6]$b[7]");}
else { push(@t,"a");}
}
($yy,$mm,$dd)=();
while(@t) {
if($yy) {}
elsif(($t[0]<17)||($t[0]>25)) {}
elsif(($t[1]<1)||($t[1]>12)) {}
elsif(($t[2]<1)||($t[2]>31)) {}
else {
$yy=$t[0];
$mm=$t[1];
$dd=$t[2];
}
shift(@t);
}
if($yy) {
$dir="20${yy}_${mm}_${dd}";
if( ! -d $dir) {
print `mkdir $dir`;
}
$g=$f;
$g=~s/ /_/g;
$g=~s/[()]/_/g;
print "mv \"$f\" $dir/$g\n";
}
} |
|