8/30/2023 0 Comments Perl file time stamp![]() ![]() If only 6 groups are used, the 6th capture (seconds) will be checked for a fraction. ![]() If you're doing something more complex you probably ought to be using one of the modules listed in "SEE ALSO".Īn optional 7th group can be used to capture the fractional seconds. The pattern must capture 6 groups in the appropriate order: year, month, day, hour, minute, second. The default pattern will match any of the named formats. timestamp order (preferably newest files last) Or do I need to read the whole directory into an. If the stamp doesn't match the pattern the function will return undef in scalar context or an empty list in list context.Īn alternate regular expression can be supplied as the regexp parameter during import. Besides Time::Local only takes the first 6 anyway. Is there a straightforward way to achieve this without resorting to making a. NOTE that the wday, yday, and isdst parameters (the last three elements returned from localtime or gmtime) are not returned because they are not easily determined from the stamp. I am using the File::Copy module to copy a file in Perl: /usr/bin/perl -w use File::Copy copy ('somefile.log', 'copiedfile.log') I would like to preserve timestamps (particularly the modification time), but this doesnt appear to be an option. In list context they return the list that would have been sent to Time::Local which is similar to the one returned by gmtime and localtime: seconds, minutes, hours, day, month (0-11), year (-1900). They accept a timestamp and use the appropriate function from Time::Local to turn it back into a seconds-since-epoch integer. Typically because I am looking for a jump in the log message times in. The parser functions are the inverse of the stamp functions. I have many times needed to calculate the difference between the timestamps in a log file. The perl rename utility is effectively a specialised scripting language that allows you to use ANY perl code to rename files, from simple s/search/replace/ regular expression operations (which suffices for most renaming tasks) to complex multi-line scripts. Version 1.300 SYNOPSIS # import customized functions to make easy-to-use timestamps may really be the 'creation timestamp' (which it is not in Unix). Time::Stamp - Easy, readable, efficient timestamp functions VERSION On Windows, according to perlport (Files and Filesystems), the inode change time time-stamp. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |