Wednesday, December 2, 2009

"Find All EXCEPT" using bash script

find . \( ! -name "hobba*" \)

The above command invokes the "find" command asking it to search in the current directory (".") and return all files except those starting with the string "hobba". Note: Take care of the spaces as one more or less space character can ruin the whole script.

The above script is taken from a bash script written by Osama Magdy that deletes all files in a certain directory except one.

No comments: