Need to find a pattern in a filename and delete all those files?
find . -name "ftp.log" -exec rm '{}' \;
You can replace "ftp.log" with "*.log" to get all files with the .log extension. The "." after find just means "search at the current directory".
I got this from this website: http://www.aota.net/forums/archive/index.php/t-20930.html
Wednesday, November 21, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
if you want to remove folders and all its child add -fvr after rm:
find . -name "ftp.log" -exec rm -fvr '{}' \;
Post a Comment