File attributes

Discussion in 'Perl Misc' started by dimas@inotech.ru, Oct 6, 2005.

  1. Guest

    Hello. Please tell me someone, how can I get file attributes in my
    script like creation time and content modification time? Thanks
    , Oct 6, 2005
    #1
    1. Advertising

  2. Guest

    wrote:
    > Hello. Please tell me someone, how can I get file attributes in my
    > script like creation time and content modification time? Thanks


    my @attr = stat($filename);

    if you look up "Perl stat" on Google, you should be able to map the
    index number in the returned array to the content stored in that index.

    also, if you are only interested in one piece of info about the file,
    like the size, you can do:

    my $filesize = (stat($filename))[7];

    hth.
    , Oct 6, 2005
    #2
    1. Advertising

  3. wrote in news:1128599639.501615.112070
    @g47g2000cwa.googlegroups.com:

    > Hello. Please tell me someone, how can I get file attributes in my
    > script like creation time and content modification time? Thanks


    perldoc perlfunc

    is the document to consult when you have a question like this. It lists
    all functions by category and alphabetically.

    Sinan

    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Oct 6, 2005
    #3
  4. Matt Garrish Guest

    <> wrote in message
    news:...
    > Hello. Please tell me someone, how can I get file attributes in my
    > script like creation time and content modification time? Thanks
    >


    Open the perlfunc documentation and look under the heading "Functions for
    filehandles, files, or directories" (hint: how would you "stat" a file
    normally). This is not a particularly good forum to be asking people to read
    the documentation for you, unless you enjoy being flamed that is.

    Matt
    Matt Garrish, Oct 6, 2005
    #4
  5. wrote in news:1128600107.377169.155320
    @g47g2000cwa.googlegroups.com:

    > if you look up "Perl stat" on Google,


    You should first consult the documentation that comes with Perl. It is
    sitting on your hard drive, waiting, patiently, wailing, quietly, for you
    to use it just this once:

    perldoc -f stat

    Sinan
    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Oct 6, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max
    Replies:
    1
    Views:
    470
    Joe Kesselman
    Sep 22, 2006
  2. P4trykx
    Replies:
    2
    Views:
    1,790
    bruce barker
    Jan 31, 2007
  3. james_027

    class attributes & data attributes

    james_027, Jun 20, 2007, in forum: Python
    Replies:
    2
    Views:
    360
    Bruno Desthuilliers
    Jun 20, 2007
  4. Kyle Schmitt
    Replies:
    3
    Views:
    179
    Kyle Schmitt
    Jul 24, 2007
  5. Jayden
    Replies:
    16
    Views:
    469
    Steven D'Aprano
    Sep 29, 2012
Loading...

Share This Page