LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   'find' command regex to exclude hidden files? (https://www.linuxquestions.org/questions/linux-newbie-8/find-command-regex-to-exclude-hidden-files-816790/)

arashi256 06-28-2010 08: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?

Code:

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

Thanks.

druuna 06-28-2010 08:44 AM

Hi,

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 08:46 AM

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

druuna 06-28-2010 08:53 AM

You're welcome :)


All times are GMT -5. The time now is 11:01 PM.