<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Looking for files hours/mins old in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855484#M936723</link>
    <description>Hi Jim,&lt;BR /&gt;maybe a little late, but I have dealt something similar, namely a request that the number of seconds since the last modfication time of a certain file be written out. &lt;BR /&gt;The approach used is a good deal slower that the other suggestions, but also has some good sides. &lt;BR /&gt;&lt;BR /&gt;The last modification of the  file - to get the second also - was obtained like this:&lt;BR /&gt;#  echo &lt;FILE&gt; | cpio -o 2&amp;gt;/dev/null  | cpio -ivt 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;Output example for /etc/passwd:&lt;BR /&gt;100444 root     2685  Nov 15 12:56:17 2002  /etc/passwd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The attached script can be  used  (with 7 parameters, see explanation in script)  for returning the number of seconds elapsed since unix start, i.e. midnight Jan 1, 1970,  and a specified date, e.g Nov. 15 2002 12:56:17, example:&lt;BR /&gt; &lt;BR /&gt;# ./return_seconds.sh 1970 2002 Nov 15 12 56 17&lt;BR /&gt;# 1037364977&lt;BR /&gt;&lt;BR /&gt;The number of seconds since unix start and current "date" can be calculated by running the attached script without parameters, e.g.:&lt;BR /&gt;# ./return_seconds.sh&lt;BR /&gt;# 1038863680&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Difference:&lt;BR /&gt;# echo 1038863680 - 1037364977 | bc&lt;BR /&gt;# 1498703&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The first parameter of the script can be used to define a year to whose midnight to  count back to; if you expect a difference of hours only you can increase execution speed considerably by entering "current minus one".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope it is of some use,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
    <pubDate>Mon, 02 Dec 2002 20:58:50 GMT</pubDate>
    <dc:creator>john korterman</dc:creator>
    <dc:date>2002-12-02T20:58:50Z</dc:date>
    <item>
      <title>Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855475#M936714</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Does anyone have a script for this or suggestions as to the best way of writing one? Just to be clear this is the problem whereby find works on a granularity of days when searching for files. I have to process files depending on how old they are, but typically hours/mins not days. I have an idea of piping ls -t into awk or cut or something, converting the hours/mins to a number and comparing to system time (also converted to something I can manipulate as a number) BUT think I might have a problem with "day boundaries" eg script runs hourly say for files 2 hrs old (say), runs at 1am but fails to pick up files with modification date/time just prior to midnight.&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Mon, 02 Dec 2002 16:27:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855475#M936714</guid>
      <dc:creator>Jim Griffiths</dc:creator>
      <dc:date>2002-12-02T16:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855476#M936715</link>
      <description>I think what you need to look at is the -newer option to find.  You can 'touch' a file and give it a particular timestamp, for example 'touch 12021000 testfile' will create a file with the timestamp of today at 10:00.  Once that is done you can use the -newer option to find to find file(s) that are newer than the file you just created.  'man find' for more details on '-newer'.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Dec 2002 16:30:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855476#M936715</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2002-12-02T16:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855477#M936716</link>
      <description>Jim,&lt;BR /&gt;&lt;BR /&gt;Check out this thread (in particular, JRF's answer concerning "newer"):&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf6640fe6d0f7d61190050090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf6640fe6d0f7d61190050090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 02 Dec 2002 16:31:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855477#M936716</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-12-02T16:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855478#M936717</link>
      <description>Take a bit of creativity, but you can do this with 2 commands.&lt;BR /&gt;&lt;BR /&gt;First, touch a new file.  This is a base file.&lt;BR /&gt;Next, find has an option that you can look at a template file for datestamp.  Now just use find's args to see if something is older than the file.&lt;BR /&gt;&lt;BR /&gt;If you really need to be specific about 2 hours old, then your forced to look at the current `date +%H` and subtract from it the timestamp field with lots of purdy awk expressions.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Mon, 02 Dec 2002 16:31:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855478#M936717</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2002-12-02T16:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855479#M936718</link>
      <description>Hi Jim,&lt;BR /&gt;&lt;BR /&gt;One way to do it might be to use 'touch' to create a file with a specific date/time stamp, and then use 'find' to get all the files newer than your touch file.  Something like this:&lt;BR /&gt;&lt;BR /&gt;touch -t 12021005 myfile&lt;BR /&gt;&lt;BR /&gt;find . -newer myfile&lt;BR /&gt;&lt;BR /&gt;That should find the files newer than 'myfile', which should have a timestamp of 10:05am.  The 'find' command will find anything newer than the myfile timestamp, so it should have any problems with midnight, etc.&lt;BR /&gt;&lt;BR /&gt;Does that help?&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Dec 2002 16:32:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855479#M936718</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-12-02T16:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855480#M936719</link>
      <description>Hi Jim&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Basically the approach is to use awk and create the list of file using a specific combination&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for eg &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ls -lR | awk '{if($6=="Aug" &amp;amp;&amp;amp; $7=="8" ) print $NF }'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;will pritn all files created on that particualr day , you can be creative with == expresions and use &amp;gt; or &amp;lt; and also in case you want a specific time range may be you can again use the same command and compare the time stamp field.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava</description>
      <pubDate>Mon, 02 Dec 2002 16:40:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855480#M936719</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-12-02T16:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855481#M936720</link>
      <description>Hi Jim:&lt;BR /&gt;&lt;BR /&gt;'find' can to this quite easily.  Consider the case where you want to find files modified between 12/02/2002 and 12/02/2002: &lt;BR /&gt;&lt;BR /&gt;# cd /tmp &lt;BR /&gt;# touch -mt 12020000 ref1 &lt;BR /&gt;# touch -mt 12020800 ref2 &lt;BR /&gt;# find . \( -type f -a -newer /tmp/ref1 -a ! -newer /tmp/ref2 \)|xargs -n 100 ls -l {}&lt;BR /&gt;&lt;BR /&gt;Notice that 'find' is restricted to entities that are of type "file".  In this example, the files are simply listed.  A pipe to 'xargs' is used in place of adding an '-exec' to the 'find' since it is less resource intensive on your system.  An 'exec' will cause a process to be spawned for every file found.  The 'xargs' will block (bundle) '-n' arguments at a time, greatly reducing process overhead.&lt;BR /&gt;&lt;BR /&gt;See the man pages for more information and options.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;</description>
      <pubDate>Mon, 02 Dec 2002 16:53:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855481#M936720</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-12-02T16:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855482#M936721</link>
      <description>All of some help, Thanks, but a bit of clarification. I want to able to process files eg say OVER 2hrs old(Shannon - don't need exactly 2hrs old). Pete - 2nd link on suggested thread might of some use if I can decipher a suggested C program. If I have to use the -newer qualifier, with the script in a cron job I could presumably have the script generate (or touch a file) to be used with find -newer 2 hrs LATER if you see what I mean! What do you think?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Mon, 02 Dec 2002 18:10:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855482#M936721</guid>
      <dc:creator>Jim Griffiths</dc:creator>
      <dc:date>2002-12-02T18:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855483#M936722</link>
      <description>JFR,&lt;BR /&gt;&lt;BR /&gt;Apologies, I see what mean, I can essentially do the same thing and generate a file with desired modification time using touch -mt &lt;TIME&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks, I think I'm sorted,&lt;BR /&gt;&lt;BR /&gt;Jim&lt;/TIME&gt;</description>
      <pubDate>Mon, 02 Dec 2002 18:17:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855483#M936722</guid>
      <dc:creator>Jim Griffiths</dc:creator>
      <dc:date>2002-12-02T18:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for files hours/mins old</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855484#M936723</link>
      <description>Hi Jim,&lt;BR /&gt;maybe a little late, but I have dealt something similar, namely a request that the number of seconds since the last modfication time of a certain file be written out. &lt;BR /&gt;The approach used is a good deal slower that the other suggestions, but also has some good sides. &lt;BR /&gt;&lt;BR /&gt;The last modification of the  file - to get the second also - was obtained like this:&lt;BR /&gt;#  echo &lt;FILE&gt; | cpio -o 2&amp;gt;/dev/null  | cpio -ivt 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;Output example for /etc/passwd:&lt;BR /&gt;100444 root     2685  Nov 15 12:56:17 2002  /etc/passwd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The attached script can be  used  (with 7 parameters, see explanation in script)  for returning the number of seconds elapsed since unix start, i.e. midnight Jan 1, 1970,  and a specified date, e.g Nov. 15 2002 12:56:17, example:&lt;BR /&gt; &lt;BR /&gt;# ./return_seconds.sh 1970 2002 Nov 15 12 56 17&lt;BR /&gt;# 1037364977&lt;BR /&gt;&lt;BR /&gt;The number of seconds since unix start and current "date" can be calculated by running the attached script without parameters, e.g.:&lt;BR /&gt;# ./return_seconds.sh&lt;BR /&gt;# 1038863680&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Difference:&lt;BR /&gt;# echo 1038863680 - 1037364977 | bc&lt;BR /&gt;# 1498703&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The first parameter of the script can be used to define a year to whose midnight to  count back to; if you expect a difference of hours only you can increase execution speed considerably by entering "current minus one".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope it is of some use,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
      <pubDate>Mon, 02 Dec 2002 20:58:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/looking-for-files-hours-mins-old/m-p/2855484#M936723</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2002-12-02T20:58:50Z</dc:date>
    </item>
  </channel>
</rss>

