First time using stat()command. I get unexpected results.
Here is the code:
while($loopnum <10)
{
$loc=(telldir(backups));
$newloc=seekdir(backups,($loc++));
$filename=readdir(backups);
($size,$mtime)=stat($filename);
$convtime=localtime($mtime);
print($filename, " is " ,$size, " bytes long, last modified on ",
+$mtime," ",$convtime,"\n");
$loopnum++;
}
returns:
. is 2308 bytes long, last modified on 218105879 Mon Nov 29 00:57:59 1976
.. is 2308 bytes long, last modified on 128 Wed Dec 31 16:02:08 1969
scripts.tgz is 2308 bytes long, last modified on 218105914 Mon Nov 29 00:58:34 1976
users.tgz is 2308 bytes long, last modified on 218105915 Mon Nov 29 00:58:35 1976
20050303.log is 2308 bytes long, last modified on 219200296 Sat Dec 11 16:58:16 1976
20050304.log is 2308 bytes long, last modified on 219200298 Sat Dec 11 16:58:18 1976
20050304.tgz is 2308 bytes long, last modified on 219200299 Sat Dec 11 16:58:19 1976
20050305.tgz is 2308 bytes long, last modified on 219200302 Sat Dec 11 16:58:22 1976
20050306.log is 2308 bytes long, last modified on 219200305 Sat Dec 11 16:58:25 1976
20050307.log is 2308 bytes long, last modified on 219200307 Sat Dec 11 16:58:27 1976
The dates and file sizes are wrong.
20050302.tgz is the backup for 2005-Mar-02; all the other files are named using the same convention.
The size of 20050304.tgz is approximately 973795939; all the other .tgz files are about the same size.
The .log files are always 70 bytes.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.