Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie mactruck's Avatar
    Join Date
    Apr 2012
    City of Salt

    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.

    find . -type f \( ! -name ".*" \) -mtime +500 -exec ls -l {} \; > ~/MIKE/old/500days$dttm.txt
    I have tried this:

    find . -type f \( ! -name ".*" \) -type d \( ! -name ".*" \) -mtime +500 -exec ls -l {} \; >> ~/notp/MIKE/old/500days$dttm.txt
    but this will not look in any folders or sub-folders
    Last edited by mactruck; 02-20-2013 at 08:36 PM.

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Virginia, USA
    cd /path/to/dir
    find * -type f ...

    Or, find /path/to/dir/* -type f ..

    NOT find /path/to/dir*

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts