Click here to get back home

changing the date/time stamp

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
changing the date/time stamp monk 02-26-2008
Posted by monk on February 26, 2008, 5:02 pm
Please log in for more thread options
Is there a "perl way" of modifying the date/time stamp of a file? Is
there a core function or core module I'm overlooking?

I guess I'd like to emulate or find the equivalent of the 'touch'
command without using system ('touch...')

# from the shell, modify xfile creation date to year 2001 January day
30 time 13:50:26
touch -t 200101301350.26 xfile


thanks in advance.


Posted by Peter Makholm on February 26, 2008, 5:06 pm
Please log in for more thread options

> Is there a "perl way" of modifying the date/time stamp of a file? Is
> there a core function or core module I'm overlooking?

See the documentation of the utime function in perlfunc.

//Makholm

Posted by monk on February 26, 2008, 5:15 pm
Please log in for more thread options
just what the doctor recommended.

you da man!! thanks.

Posted by Tad J McClellan on February 26, 2008, 8:16 pm
Please log in for more thread options
> Is there a "perl way" of modifying the date/time stamp of a file? Is
> there a core function or core module I'm overlooking?


perldoc -f utime


> # from the shell, modify xfile creation date to year 2001 January day
^^^^^^^^^^^^^
> 30 time 13:50:26
> touch -t 200101301350.26 xfile


touch does NOT modify the creation date, because there is no
such thing on most *nix filesystems...


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher0cmdat/"

Similar ThreadsPosted
problem with time stamp July 13, 2006, 9:19 am
To change the time stamp format... April 2, 2005, 10:01 am
Using DateTime June 5, 2007, 8:58 am
DateTime.pm and midnight December 29, 2005, 3:38 pm
datetime problem May 27, 2006, 12:40 pm
Problem with DateTime August 1, 2006, 2:20 am
using DateTime object November 29, 2006, 4:16 pm
How to convert datetime format? January 26, 2006, 11:40 am
dbi ODBC problem executing prepared statement taking datetime type April 27, 2006, 11:23 am
perl doc url changing September 1, 2005, 2:52 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap