
drakal30
New User
Jan 8, 2013, 7:48 AM
Post #3 of 3
(1833 views)
|
Re: [FishMonger] Help with setting unix file timestamp in perl
[In reply to]
|
Can't Post
|
|
Thanks for the reply, I realized my newbie mistake and fixed it.
#!/usr/bin/perl use strict; use warnings; use POSIX; my $file = "/var/tmp/testtime"; my $now = time(); my $before1 = $now - (30*60); # 15 minutes ago #my $before2 = $now - (3*60*60); # 3 hours ago #my $before3 = $now - (2*24*60*60); # 2 days ago open my $fh, '>', $file or die "Can't create /tmp/file: $!\n"; utime($before1, $before1, $file); close $fh; I am using the dummy file's time stamp to test against for another script.
|