初学Perl 用Perl解决了自己的小问题

前端之家收集整理的这篇文章主要介绍了初学Perl 用Perl解决了自己的小问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

问题描述:用扫描仪扫描的文件都创立一个文件夹,现在要把文件提取出来。嘿嘿,我是菜鸟,请多指教。

测试环境:sygwin 

#!/usr/bin/perl -w $files_name = "/home/xuan/testdir/QUST"; chdir $files_name; my @files = glob "*"; foreach my $single_file (@files){ next unless $single_file =~ /^2014/; my $file_name = $files_name . "/" . $single_file; chdir $file_name; my @file = glob "*"; foreach (@file){ $photo_path = $files_name ."/" . $_; rename $_,$photo_path; } chdir $files_name; rmdir $single_file; print "$file_name\n"; }

猜你在找的Perl相关文章