#!/usr/bin/perl -w use strict; ## Scott Wiersdorf ## Created: Mon Sep 12 11:43:18 MDT 2005 ## $Id$ ## retouch: make a file have the same date as another file ## usage: touch oldfile file1 [file2 ...] ## make file1 have the same date as oldfile unless( scalar @ARGV > 1 ) { usage(); } my $src = shift @ARGV; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime((lstat($src))[9])) [0..5]; $year += 1900; $mon += 1; system('/usr/bin/touch', '-t', sprintf("%d%02d%02d%02d%02d.%02d", $year, $mon, $mday, $hour, $min, $sec), @ARGV); exit; sub usage { die <<'_USAGE_'; usage: retouch oldfile file1 [file2 ...] retouch makes file1, et al. have the same mtime and atime as oldfile. _USAGE_ }