File: ztouch

package info (click to toggle)
gzip 1.3.12-9%2Bsqueeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,156 kB
  • ctags: 1,389
  • sloc: ansic: 8,868; sh: 4,609; makefile: 186; asm: 179; perl: 11
file content (15 lines) | stat: -rwxr-xr-x 384 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /usr/local/bin/perl
# Set the time stamp of a gzip'ed file from that stored in the file.
# usage: ztouch files...

foreach $file (@ARGV) {
    open (FILE, $file);
    read (FILE, $_, 8);
    ($magic, $method, $flags, $time) = unpack ("A2C2V", $_);
    if ($magic eq "\037\213") {
	utime ($time, $time, $file);
    }
    else {
	warn "$file is not compressed with gzip!\n";
    }
}