Topic
5 replies Latest Post - ‏2013-08-27T12:01:26Z by vbalaji11
GuilhermeDeMario
GuilhermeDeMario
3 Posts
ACCEPTED ANSWER

Pinned topic Find files by date range

‏2013-08-20T14:10:49Z |

Hi there,

I'd like to know if it's possible to find files on AIX between a date range, for example: I want to find all files that were created between 01-Aug-2013 and 31-Aug-2013.

p.s: I access the AIX server by telnet (not sure if this info is important, just to mention it).

I've searched online and I found several ways to do that, but none of them worked (the trick to create a empty file using touch to use the -newer option is not possible, once the touch command for me does not work due to user roles).

Thanks!

Updated on 2013-08-20T14:12:24Z at 2013-08-20T14:12:24Z by GuilhermeDeMario
  • vbalaji11
    vbalaji11
    17 Posts
    ACCEPTED ANSWER

    Re: Find files by date range

    ‏2013-08-21T06:04:42Z  in response to GuilhermeDeMario

    Hi,

     

    Can you be more specific regarding, if it is file Creation or modification time !?

    more about " time " associated with files

     

    If its modification time, this might help " ls -l | grep Aug "

    hope it helps :)

     

    • GuilhermeDeMario
      GuilhermeDeMario
      3 Posts
      ACCEPTED ANSWER

      Re: Find files by date range

      ‏2013-08-21T12:06:03Z  in response to vbalaji11

      Hi vbalaji11,

      Many thanks for your kind help :-)

      Yesterday I could make it works using this command:

      find . -mtime +12 ! -mtime +16

      I made a spreadsheet where I can get these numbers (12 and 16 in this example) using the formula =TODAY()-Start_date and TODAY()-End_date, so this way I can filter all the files by a date range.

  • vbalaji11
    vbalaji11
    17 Posts
    ACCEPTED ANSWER

    Re: Find files by date range

    ‏2013-08-26T06:19:21Z  in response to GuilhermeDeMario

    Hi GuilhermeDeMario,

    So happy to know,  that the job's done.

    It would be very helpfu and nice of you, if you could explain a little more about how you achieved it.

    I am a newbie to spreadsheet  handling in AIX, but eager to know how it worked out in this case. Kindly share links, if any.

    Thanks in advance :)

     

    • GuilhermeDeMario
      GuilhermeDeMario
      3 Posts
      ACCEPTED ANSWER

      Re: Find files by date range

      ‏2013-08-26T12:09:19Z  in response to vbalaji11

      Hi vbalaji11,

      I used the spreadsheet attached in this message.
      Just put the start and end date and the formula will generate the AIX command to find files between date range for you.

      P.s: you can ignore the | xargs grep -lR 'STRING' if you want, I just made this because in my case, I had to find files between a date range and these files must had a string inside it.

      Hope it helps :-)

      Attachments

      Updated on 2013-08-26T12:11:56Z at 2013-08-26T12:11:56Z by GuilhermeDeMario
      • vbalaji11
        vbalaji11
        17 Posts
        ACCEPTED ANSWER

        Thanks for your time

        ‏2013-08-27T12:01:26Z  in response to GuilhermeDeMario

        Dear friend,

        Thanks again. I am clear how the dates from the sheet is utilised in the find command later piped by ur grep.

        In find command " find . -mtime +12 ! -mtime +16 ", I have assumed like " ! " helps in fetching the files that are having the (mintime - initialisation time) prior to END date. i.e. like a NOT gate. While the later -mtime 16 helps in fetching the files that are older than the (mintime - init time) START DATE.

        Just correct, if I am wrong anywhere.

        It really helped :)