linux search file based on file name pattern [closed]

Solution 1:

If you're wanting to limit your search to the current directory, use:

find . -maxdepth 1 -mindepth 1 ! -name '*_bak'

If you want to recursively find in all directories remove the -maxdepth 1.


Edit in response to OP's comment

To get files that begin with ei and do not end with _bak use:

find . -type f -name 'ei*' -a ! -name '*_bak'

Solution 2:

Please try this :

 find . -type f ! -iname "*_bak"

The above command will find all files that have not end with _bak.