Find the answer to your Linux question:
Results 1 to 4 of 4
trying to get a command to find files that match a certain date, then run a command on them. i dont want to use find with atime,mtime,ctime because that gives ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    20

    find files by exact date!!??


    trying to get a command to find files that match a certain date, then run a command on them. i dont want to use find with atime,mtime,ctime because that gives all files greater or less then specified day...not exact.

    so i came up with this command

    Code:
    ls -ltr | grep 'Jan 16' | xargs ??????
    the grep command returns something like this
    Code:
    -rw-rw-r-- 1 me mygroup 0 Jan 16 09:44 myFile
    so i need to figure how how to get xargs only to see "myFile" and not the whole line so i can run a command on it. how can I do this???
    thanks
    -Ray

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    I believe if you do not specify a time with a minus (-) or plus (+) but just the number of days ago, for example: 30, it will give the date. Check the info on this site:

    Find files by access, modification date under Linux or UNIX

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    20
    wow i feel like an idiot....thanks man that worked great!!

  4. #4
    Just Joined!
    Join Date
    Jan 2011
    Posts
    1

    can use awk to extract a specific field

    This can work too.
    Little late to help you with your original problem I suppose!

    ls -lR | grep '2007-' | awk '{ print $8 }'

    ********************************888

    ls -ltr | grep 'Jan 16' | xargs ??????

Posting Permissions

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