(no title)
ralph | 12 years ago
perl -e 'opendir D, "."; @f = grep {$_ ne "." && $_ ne ".."} readdir D;
unlink(@f) == $#f + 1 or die'
It goes a bit quicker still if @f and the error handling are omitted.The original article is comparing different things some of the time, e.g. find is having to stat(2) everything to test if it's a file.
psutor|12 years ago
ralph|12 years ago