写了个perl的删除程序
程序员文章站
2022-03-07 23:24:25
大家有没有碰到过unix上,一个目录文件太多,无法删除的现象,我为大家写了个perl的程序删除复制代码 代码如下:cat > del.pl#!/u...
大家有没有碰到过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*`;