大家有没有碰到过unix上,一个目录文件太多,无法删除的现象,我为大家写了个perl的程序删除
复制代码 代码如下:
cat > del.pl
#!/usr/bin/perl
$file1=$ARGV[0];
@tests=(1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','G','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
foreach $test(@tests) {
$file=$file1.$test;
@chars=(0,1,2,3,4,5,6,7,8,9,'A','B','C','D');
foreach $char(@chars) {
`rm $file$char*`;
}
`rm $file*`;
}
`rm $file1*`;
复制代码 代码如下:
cat > del.pl
#!/usr/bin/perl
$file1=$ARGV[0];
@tests=(1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','G','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
foreach $test(@tests) {
$file=$file1.$test;
@chars=(0,1,2,3,4,5,6,7,8,9,'A','B','C','D');
foreach $char(@chars) {
`rm $file$char*`;
}
`rm $file*`;
}
`rm $file1*`;