2006/11/14

Delete multiple files in Perl

Just found a way to delete useless files in a current directory.


foreach $file (<*.tmp>) { # step through a list of .tmp files
unlink($file) || warn "having trouble deleting $file: $!";
}


reference

No comments:

Post a Comment