Find the answer to your Linux question:
Results 1 to 3 of 3
hi i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old) i tried this command ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    6

    finding files exactly 7 days old

    hi
    i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old)
    i tried this command
    find /var/backup -mtime +7 -exec ls -d {} \;
    but this gives me even the files which are older than 7 days

    find . -mtime +7 -exec ls -d {} \;
    ./access.log.1.gz
    ./access.log.2.gz
    ./access.log.2.gz19Apr10
    ./access.log.3.gz
    ./access.log.3.gz19Apr10
    ./access.log.4.gz



    i want only the file which is 7 days old

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Try this:

    Code:
    find . -mtime +6 -mtime -8 -exec ls -d {} \;

  3. #3
    Just Joined!
    Join Date
    Apr 2010
    Posts
    5
    hey
    dont put a + before 7,
    that means you're finding files MORE than seven days.
    check the find command man page

Posting Permissions

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