#!C:/Perl/bin/perl.exe -w
# name:put_ring.pl
# func:将平台割接上来的铃音根据12位铃音id 4-3-3-2路径下存放。
# author:wangzhihong.china@gmail.com
# 补充说明:放在铃音ftp的根路径下
# 调用方法:命令行下 put_ring.pl 平台铃音路径,比如 put_ring.pl sz 其中sz是某个平台铃音割接上来的路径
use strict;
use warnings;
use File::Path;
use File::Basename;
use File::Spec::Win32;
use File::Find;
use File::Copy;
use Cwd;
my $target=getcwd;
sub wanted{
if (-f $File::Find::name){
if ($File::Find::name=~/wav/){
my $FirstDir=$target."/".substr($_,0,4);
my $SecondDir=$FirstDir."/".substr($_,4,3);
my $ThirdDir=$SecondDir."/".substr($_,7,3);
my $FourthDir=$ThirdDir."/".substr($_,10,2);
if(! -e $FirstDir){
mkdir $FirstDir||die("error1");;
}
if (! -e $SecondDir){
mkdir $SecondDir||die("error2");;
}
if (! -e $ThirdDir){
mkdir $ThirdDir||die("error3");;
}
if (! -e $FourthDir){
mkdir $FourthDir||die("error4");;
}
my $filename=$_;
copy($File::Find::name,$FourthDir."/".$filename);
}
}
}
find(&wanted,"$target/$ARGV[0]");
print "it is ok nown";
exit;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/47869/viewspace-833540/ ,如需转载,请注明出处,否则将追究法律责任。