"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.

Unknown's avatar

About Ahmed Tawfik

Cybersecurity Professional, Systems Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a comment