4 ms·
# delete a bunch of matching files and print the name find . -name whatever\* -type f | perl -ne 'print;chomp;unlink' Can't you use `rm` instead (ask it to b
by 0xmohit 10y ago
# delete a bunch of matching files and print the name
find . -name whatever\* -type f | perl -ne 'print;chomp;unlink'
Can't you use `rm` instead (ask it to be verbose):
find . -name whatever\* -type f -exec rm -v -- {} \;
- tyingq 10y agoYou can...it spawns a lot of processes. And typically, I'm doing more than 'print;chomp;unlink'. Maybe renaming files from <pattern>.foo to <pattern>.bar or whatever.
- emmelaich 10y agoYou should use the -delete predicate/arg to find to delete things if your find has it. To avoid race conditions.