都用了File::Path 了, 怎么不用  rmtree 呢

unlink 比 rm -rf $file 要高效得多



2009/11/16 Fayland Lam <[email protected]>

> 2009/11/16 Fayland Lam <[email protected]>:
> >    rename ("mol_num[$i] , input.mol")||die   $!;
> >      move "input.mol , /home_dir/operation";
> >
> > should be
> >    rename(mol_num[$i] , input.mol)||die   $!;
>
> >    rename(mol_num[$i] , "input.mol")||die   $!;
>
> >      move("input.mol" , "/home_dir/operation/");
> >
> > 2009/11/16 earthminator <[email protected]>:
> >>
> >> 在Linux中编写一个程序,目的是从mol文件夹中调取文件到operation文件夹中运行,再把结果传到result文件中。因为
> >> dssmol.exe只能运行input.mol的文件,所以要把它改名。比且运行结果是一个output文件,然后要把它在给名放到result文件
> >> 夹中。于是我编写如下程序:
> >> #!/usr/bin/perl
> >>
> >> use Cwd;
> >> use File::Path;
> >> use Shell;
> >> use File::Copy;
> >>
> >> $home_dir = cwd;
> >> $mol_dir = $home_dir .'/mols';
> >> $operation_dir = $home_dir .'/operation';
> >> $result_dir = $home_dir.'/result';
> >> chair ($mol_dir);  #change to molecules directory
> >> @mol = glob ('*.mol');  #get all molecules files
> >> $mol_num = @mol;
> >> print "Total @mol_num molecules.\n";
> >> $i=0;
> >> while ($i<$mol_num) {
> >>   print "mol_num[$i]";
> >>     rename ("mol_num[$i] , input.mol")||die   $!;
> >>       move "input.mol , /home_dir/operation";
> >>       system "rm -rf $input.mol";
> >>       chair($operation_dir); #begin to run MODEL under this directory
> >>       system " ./dssmol.exe";
> >>          move "output , /home_dir/result/";
> >>             system "rm -rf $input.mol";
> >>             system "rm -rf $output";
> >>                chair($result_dir); #change to result directory
> >>             rename ("output , $i")||die   $!;
> >>             system "rm -rf $output";
> >>
> >>
> >>   i++};
> >> 在运行后出现的问题是
> >> Not enough arguments for rename at mol1.pl line 22, near ""mol_num
> >> [$i] , input.mol")"
> >> Not enough arguments for rename at mol1.pl line 31, near ""output ,
> >> $i")"
> >> Execution of mol1.pl aborted due to compilation errors.
> >>
> >> 由于刚学perl,我不知道怎么处理这个问题。。。
> >>
> >> >>
> >>
> >
> >
> >
> > --
> > Fayland Lam // http://www.fayland.org/
> >
>
>
>
> --
> Fayland Lam // http://www.fayland.org/
>
> >
>


-- 
           Yours Sincerely
                   Zeng Hong

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
 要在此论坛发帖,请发电子邮件到 [email protected]
 要退订此论坛,请发邮件至 [email protected]
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

回复