teach me the better way
hi! i have a hundred file in my file server with an extension ex:
bak,autobak,backup of.......etc and i want to delete it every day to save some space and i do it like this find . -name *.bak -print -exec rm {} \; find . -name *.autobak -print -exec rm {} \; and so on:( is there a better way to combine all bak,autobak,backup of in one command??? i try this but doest work correct me if iam wrong:) the command is: find . -name '*.[bak autobak backup of]' -print -exec rm {} \; |
well, to remove all files which have three letters "bak" in it, just do
find . -name *.*bak* -print -exec rm {} \; the problem is that it will remove ALL files with those three letters inside...so be aware ;) |
Use the -o (OR) option
find . \( -name *bak -o -name *autobak -o -name backup \) -print -exec ls -l {} \; Change ls -l to rm when you are sure this does what you want. |
thks guy for your reply:)
|
All times are GMT -5. The time now is 07:04 PM. |