File information??

Discussion in 'Python' started by Stan Cook, Jul 4, 2003.

  1. Stan Cook

    Stan Cook Guest

    Is there a way to get the file size and modified date of a file?
    Stan Cook, Jul 4, 2003
    #1
    1. Advertising

  2. Stan Cook

    Egor Bolonev Guest

    Hello, Stan!
    You wrote on Fri, 04 Jul 2003 05:59:10 GMT:

    SC> Is there a way to get the file size and modified date of a file?

    os.stat()

    =========Beginning of the citation==============
    import os,glob

    a=glob.glob('c:\\*')[0]
    print os.stat(a)[6],os.stat(a)[8]

    =========The end of the citation================

    With best regards, Egor Bolonev. E-mail: [ru eo en]
    Egor Bolonev, Jul 4, 2003
    #2
    1. Advertising

  3. Stan Cook

    Stan Cook Guest

    Thanks! I'll try that.
    "Egor Bolonev" <> wrote in message
    news:be36cf$j23$...
    > Hello, Stan!
    > You wrote on Fri, 04 Jul 2003 05:59:10 GMT:
    >
    > SC> Is there a way to get the file size and modified date of a file?
    >
    > os.stat()
    >
    > =========Beginning of the citation==============
    > import os,glob
    >
    > a=glob.glob('c:\\*')[0]
    > print os.stat(a)[6],os.stat(a)[8]
    >
    > =========The end of the citation================
    >
    > With best regards, Egor Bolonev. E-mail: [ru eo en]
    >
    Stan Cook, Jul 4, 2003
    #3
  4. Stan Cook

    Stan Cook Guest

    Thanks.....That did it... Just what I was looking for!

    Stan
    "Ian Bicking" <> wrote in message
    news:...
    > On Fri, 2003-07-04 at 00:59, Stan Cook wrote:
    > > Is there a way to get the file size and modified date of a file?

    >
    > os.stat(filename).st_size and os.stat(filename).st_mtime
    >
    > Ian
    >
    >
    >
    Stan Cook, Jul 4, 2003
    #4
    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. z. f.
    Replies:
    0
    Views:
    676
    z. f.
    Feb 3, 2005
  2. subrato
    Replies:
    8
    Views:
    914
    Juan T. Llibre
    Mar 14, 2006
  3. clercmedia
    Replies:
    2
    Views:
    32,279
    clercmedia
    Dec 9, 2005
  4. lerenard001
    Replies:
    0
    Views:
    421
    lerenard001
    Jul 7, 2008
  5. lerenard001
    Replies:
    0
    Views:
    472
    lerenard001
    Jul 9, 2008
Loading...

Share This Page