voice copy
#!/usr/bin/perl
use File::Copy;
if ($ARGV[0] =~ /\/$/) {
$src = $ARGV[0];
} else {
$src = $ARGV[0] . "/";
}
if ($ARGV[1] =~ /\/$/) {
$dst = $ARGV[1];
} else {
$dst = $ARGV[1] . "/";
}
opendir(DIRHANDLE, $src) || die "Cannot opendir $src: $!";
foreach $fname (readdir(DIRHANDLE)) {
if (!($fname =~ /^\./))
{
$file = $src . $fname;
@t = localtime ( ( ( stat ( $file ) ) [9] ) );
@f = split(/[(.]/,$fname);
$s = sprintf("@f[0]_%04d%02d%02d_%02d%02d%02d.wav",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0]);
printf("%s\t%s\n",$file,$dst . $s);
copy($file, $dst . $s) || die "Cannot rename $file to $s: $!";
}
}
closedir(DIRHANDLE);
- Platform : Unix
- Script : perl
- desc :
An improved version that copies the files from source directory to destination directory after renaming.
No comments:
Post a Comment