Thursday, 14 April 2011

Deleting .FS and .ES recursively.

for j in `find -maxdepth 1 -name '*parallel'`; do cd $j; echo $j; for i in `find -mount -name "*.ES"`; do ls -lha $i; done; cd ..; done;

Change the ls to rm when comfortable.

Or, bigger:


for j in `find -maxdepth 1 -name '*parallel'`; do cd $j; echo $j; for i in `find -mount -name "*.ES"`; do rm $i; done; for i in `find -mount -name "*.FS"`; do rm $i; done; cd ..; done;

------------------------

The find command gives a cleaner approach:
 
find . -type f -name "*.ES" -exec ls -lha {} \;

ls -lha can be replaced with, say, rm when I'm happy the command is working as expected.