-   Linux - Newbie (
-   -   'find' command regex to exclude hidden files? (

arashi256 06-28-2010 09:27 AM

'find' command regex to exclude hidden files?
I have the following command which finds all files that have changed in the last day and lists them. How can I exclude hidden files like .bash_history?


find /home/jon -type f -mtime -1 -print
Some sort of regex?


druuna 06-28-2010 09:44 AM


If you are only interested in removing the dot-files and not the dot-directories:

find /home/jon -not -name "\.*" -type f -mtime -1 -print

If all dot-directories need to be excluded as well:

find /home/jon -type f -mtime -1 -print | grep -v "/\."

Hope this helps.

arashi256 06-28-2010 09:46 AM

Thanks very much! I didn't know you could use something like -not...good to know :)

druuna 06-28-2010 09:53 AM

You're welcome :)

All times are GMT -5. The time now is 10:01 AM.