Results 1 to 2 of 2
I need help with my find command. I want to search files that are older than 500 days and remove them. Before I did this I decided it would be ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-20-2013 #1
help with find command
I need help with my find command. I want to search files that are older than 500 days and remove them. Before I did this I decided it would be nice to print a list of the files to a tmp file so I can verify my script is working before I delete something that I was not supposed to. I ran the script below and it gives me a list of all the old files. The only problem is it is listing hidden folders. I do not want to remove any hidden folders or files. I thought I did that with the -type f \( ! -name ".*" \) command but it is still listing hidden folders.
I have tried this:Code:find . -type f \( ! -name ".*" \) -mtime +500 -exec ls -l {} \; > ~/MIKE/old/500days$dttm.txt
but this will not look in any folders or sub-foldersCode:find . -type f \( ! -name ".*" \) -type d \( ! -name ".*" \) -mtime +500 -exec ls -l {} \; >> ~/notp/MIKE/old/500days$dttm.txtLast edited by mactruck; 02-20-2013 at 07:36 PM.
- 02-20-2013 #2Linux Enthusiast
- Join Date
- Apr 2012
- Location
- Virginia, USA
- Posts
- 561
cd /path/to/dir
find * -type f ...
Or, find /path/to/dir/* -type f ..
NOT find /path/to/dir*


Reply With Quote
