放置鈴音的程式

wangzh3發表於2006-05-08

#!C:/Perl/bin/perl.exe -w
# name:put_ring.pl
# func:將平臺割接上來的鈴音根據12位鈴音id 4-3-3-2路徑下存放。
# author:
# 補充說明:放在鈴音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;

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/47869/viewspace-833540/,如需轉載,請註明出處,否則將追究法律責任。

相關文章