<?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: Touch the files in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947725#M97829</link>
    <description>Thanks for the help!! but the time i have mentioned is just an example. Can you please put it in generic terms...Herez the description again&lt;BR /&gt;&lt;BR /&gt;I need to touch the recent file in a path with a time stamp, 2 minutes newer than the older file.</description>
    <pubDate>Tue, 20 Feb 2007 06:27:16 GMT</pubDate>
    <dc:creator>viseshu</dc:creator>
    <dc:date>2007-02-20T06:27:16Z</dc:date>
    <item>
      <title>Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947723#M97827</link>
      <description>When i give ll -t , i will get the most recent files.&lt;BR /&gt;I need to change the timestamp of particular filetype to that of the oldest file ( actually 2min later than the oldest file)&lt;BR /&gt;for example:&lt;BR /&gt;if i hav 2 files: file1,file2&lt;BR /&gt;file1 is having time stamp of 12:00&lt;BR /&gt;file2 is having time stamp of 9:00&lt;BR /&gt;&lt;BR /&gt;i need the time stamp of file1 to be changed to 9:02&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;pls help</description>
      <pubDate>Tue, 20 Feb 2007 04:34:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947723#M97827</guid>
      <dc:creator>viseshu</dc:creator>
      <dc:date>2007-02-20T04:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947724#M97828</link>
      <description>Hi,&lt;BR /&gt;see "man touch"&lt;BR /&gt;touch -t 200702190902 file1&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Feb 2007 04:40:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947724#M97828</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-02-20T04:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947725#M97829</link>
      <description>Thanks for the help!! but the time i have mentioned is just an example. Can you please put it in generic terms...Herez the description again&lt;BR /&gt;&lt;BR /&gt;I need to touch the recent file in a path with a time stamp, 2 minutes newer than the older file.</description>
      <pubDate>Tue, 20 Feb 2007 06:27:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947725#M97829</guid>
      <dc:creator>viseshu</dc:creator>
      <dc:date>2007-02-20T06:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947726#M97830</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;file=`ls -t1 $1| tail -1`&lt;BR /&gt;file2=`ls -t1 $1| tail -2 | head -1`&lt;BR /&gt;ar -r foo $1/$file&lt;BR /&gt;timer=`tail -1 foo | awk -F' ' '{print $2}'`&lt;BR /&gt;echo "Original file $file " `echo "0d$timer=Y" | adb | tr -d '\011'`&lt;BR /&gt;timer=`expr $timer + 120`&lt;BR /&gt;newdate=`echo "0d$timer=Y" | adb | tr -d '\011' `&lt;BR /&gt;year=`echo $newdate | awk '{print $1}'`&lt;BR /&gt;month=`echo $newdate | awk '{print $2}'`&lt;BR /&gt;day=`echo $newdate | awk '{print $3}'`&lt;BR /&gt;time=`echo $newdate | awk '{print $4}'`&lt;BR /&gt;hour=`echo $time  | awk -F':' '{print $1}'`&lt;BR /&gt;min=`echo $time  | awk -F':' '{print $2}'`&lt;BR /&gt;&lt;BR /&gt;typeset -u mmm=`echo $month` &lt;BR /&gt;typeset -u months=`cal $year | grep "[A-Z][a-z][a-z]"`&lt;BR /&gt;i=1&lt;BR /&gt;for mon in $months&lt;BR /&gt;do&lt;BR /&gt;if [ "$mon" != "$mmm" ]&lt;BR /&gt;then&lt;BR /&gt;i=`expr $i + 1`&lt;BR /&gt;else&lt;BR /&gt;typeset -xZ2 i&lt;BR /&gt;month=$i&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;echo "touch -t $year$month$day$hour$min $1/$file2"&lt;BR /&gt;&lt;BR /&gt;Assuming your files are in ./test&lt;BR /&gt;$ ll ./test&lt;BR /&gt;total 0&lt;BR /&gt;-rw-rw-rw-   1 xxxxxxxx   users            0 Feb 20 12:00 file1&lt;BR /&gt;-rw-rw-rw-   1 xxxxxxxx   users            0 Feb 20 09:00 file2&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;Running:&lt;BR /&gt;./a.sh ./test&lt;BR /&gt;Original file file2  2007 Feb 20 09:00:00&lt;BR /&gt;touch -t 200702200902 ./test/file1&lt;BR /&gt;$ &lt;BR /&gt;&lt;BR /&gt;Have you thought about reversing the date listing with ls -lrt ?&lt;BR /&gt;&lt;BR /&gt;Please also read:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt; on how to reward any useful answers given to your questions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Feb 2007 07:49:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947726#M97830</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-02-20T07:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947727#M97831</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# perl -wle '$f1=shift;$f2=shift;$t=(stat($f1))[9]-120;utime($t,$t,$f2)' file1 file2&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Feb 2007 07:54:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947727#M97831</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-02-20T07:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947728#M97832</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Oops, you want 'file' to be timestamped 2-minutes *later* than 'file2', so:&lt;BR /&gt;&lt;BR /&gt;# perl -wle '$f1=shift;$f2=shift;$t=(stat($f2))[9]+120;utime($t,$t,$f1)' file1 file2&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Feb 2007 08:00:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947728#M97832</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-02-20T08:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947729#M97833</link>
      <description>Viseshu,&lt;BR /&gt;I assume this problem is now resolved ?&lt;BR /&gt;&lt;BR /&gt;Could you please complete the thread by awarding points to helpful answers and summarising the solution for you.&lt;BR /&gt;&lt;BR /&gt;This will help resolution of similar problems in the future.</description>
      <pubDate>Thu, 22 Feb 2007 07:48:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947729#M97833</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-02-22T07:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947730#M97834</link>
      <description>ls -rt $PATH|head -1|read FILE&lt;BR /&gt;then if i give &lt;BR /&gt;touch -r FILE FILE1&lt;BR /&gt;the timestamp will be changed..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But i dont want this FILE as reference. i want its timestamp to be taken as reference since while touchin the file, the reference file may b moved by some other job..&lt;BR /&gt;pls help</description>
      <pubDate>Sun, 25 Feb 2007 23:50:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947730#M97834</guid>
      <dc:creator>Pavitra</dc:creator>
      <dc:date>2007-02-25T23:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Touch the files</title>
      <link>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947731#M97835</link>
      <description>&amp;gt;Pavitra: But i dont want this FILE as reference.&lt;BR /&gt;&lt;BR /&gt;(Are you somehow the author too?)&lt;BR /&gt;&lt;BR /&gt;If you want it 2 minutes later, you can't use touch -r.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;i want its timestamp to be taken as reference since while touching the file, the reference file may be moved by some other job&lt;BR /&gt;&lt;BR /&gt;This can happen in any of the above scenarios.  You will have to legislate that you can't have another job, or the window is so small it won't matter.  With solutions by Peter and JRF, the window will be very small, after your reference file is found.  Of course if you have to change the time on N files, you may have to create a dummy reference file to use for the N other files.</description>
      <pubDate>Mon, 26 Feb 2007 22:33:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/touch-the-files/m-p/3947731#M97835</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-26T22:33:05Z</dc:date>
    </item>
  </channel>
</rss>

