AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Find files by date range

    Posted Tue August 20, 2013 10:11 AM

    Originally posted by: GuilhermeDeMario


    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!



  • 2.  Re: Find files by date range

    Posted Wed August 21, 2013 02:05 AM

    Originally posted by: vbalaji11


    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 :)

     



  • 3.  Re: Find files by date range

    Posted Wed August 21, 2013 08:06 AM

    Originally posted by: GuilhermeDeMario


    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.



  • 4.  Re: Find files by date range

    Posted Mon August 26, 2013 02:19 AM

    Originally posted by: vbalaji11


    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 :)

     



  • 5.  Re: Find files by date range

    Posted Mon August 26, 2013 08:09 AM
      |   view attached

    Originally posted by: GuilhermeDeMario


    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 :-)

    Attachment(s)



  • 6.  Thanks for your time

    Posted Tue August 27, 2013 08:01 AM

    Originally posted by: vbalaji11


    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 :)