Tuesday, July 24, 2007

Find and Remove files recusively Linux

find ./ -name subsub* -ok rm -r {} \;

find ./ -name *.class -ok rm -r {} \;

Will search for any file or (sub)dir and delete it after asking politly…

find ./ -name sub* -exec rm -rf {} \;

Will search for any file or (sub)dir, delete it and won’t tell anyone at all…

The trick is, the {} in the rm command, will be repaced by what ever the find commands finds… (obviously, you dont have to delete..

0 Comments: