D:\资产清查照片>dir /S /D | perl -ne "if(/的目录/){ $_ =~ s/\s+的目录//; print $
_;}" > d:\workspace\dir2.txt
D:\workspace>perl aa.pl lanshanZM.txt dir1.txt > cpls.bat
D:\workspace>cpls.bat
open RH, $ARGV[0]; @lnAs = <RH>; chomp @lnAs; close RH; open RH, $ARGV[1]; @lnBs = <RH>; chomp @lnBs; close RH; print ‘mkdir d:\\workspace\\lanshanJZ‘ . "\n"; for($i = 0; $i < @lnAs; $i ++){ for($j = 0; $j < @lnBs; $j ++){ if($lnBs[$j] =~ /$lnAs[$i]/){ print ‘mkdir d:\\workspace\\lanshanJZ\\‘ .$lnAs[$i] . "\n"; print ‘copy ‘.$lnBs[$j].‘ d:\\workspace\\lanshanJZ\\‘.$lnAs[$i]. "\n"; last; } } if($j >= $#lnBs){ print ‘#‘.$lnAs[$i] . "\n"; } }
时间: 2024-10-09 06:36:47