[SunHELP] touch cmd.

Doug McLaren dougmc at frenzy.com
Tue May 7 02:20:01 CDT 2002


On Thu, May 02, 2002 at 11:44:26AM +0200, Simon Jespersen wrote:

| Hi list!
| When i touch a file like this
| touch -r timestamp.fil some_file
| 
| The some-file get the same datestamp as timestam.fil
| thats cool
| but i what i would like to know wether it is possible to mark the some_file
| with the same datesatamp as timestamp.fil - 1 hour/minutte.

Not with touch, no.  Not in any sane manner anyways.

perl could do it easily enough, however.  Something like this --

   #!/usr/bin/perl -w
   # Usage: touch-minus file1 file2
   my $file1 = shift ;
   my $file2 = shift ;
   my ($mtime) = (stat($file1))[9] or die "$!" ;
   $mtime -= 3600 ;
   utime $mtime, $mtime, $file2 or die "$!" ;

-- 
Doug McLaren, dougmc at frenzy.com
Entropy requires no maintenance. --Markoff Chaney



More information about the SunHELP mailing list