Re: os.path.isfile with *.tar.gz

Discussion in 'Python' started by Steve Holden, Mar 15, 2007.

  1. Steve Holden

    Steve Holden Guest

    Boudreau, Emile wrote:
    > Hello All,
    > I'm new to Python and it looks like people that post here do get
    > a good answer back so I figured I'd try my luck.
    >
    > I'm trying to check a directory to see if there is a file that has the
    > name "startOfString" + some version number + "inst.tar.gz"
    > (component-8.3.16-inst.tar.gz) The version number will change quite
    > frequently so I just want to check if there is a file with that format name.
    >
    > I have tried variations of: os.path.isfile( os.path.join("C:\\temp\\",
    > "rqp-win32-app", "*.tar.gz"))
    > but nothing seem to work. Does anyone have suggestions on how I could
    > get this to work?
    >
    > Thanks in advance for the help,
    > Emile
    >
    >
    > This message may contain privileged and/or confidential
    > information. If you have received this e-mail in error or are not the
    > intended recipient, you may not use, copy, disseminate or distribute it;
    > do not open any attachments, delete it immediately from your system and
    > notify the sender promptly by e-mail that you have done so. Thank you.
    >

    Take a look at the glob module documentation. Glob.glob will almost
    certainly do what you want, as it's specifically written to match
    wildcard filenames.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC/Ltd http://www.holdenweb.com
    Skype: holdenweb http://del.icio.us/steve.holden
    Blog of Note: http://holdenweb.blogspot.com
    See you at PyCon? http://us.pycon.org/TX2007
     
    Steve Holden, Mar 15, 2007
    #1
    1. Advertising

  2. > Boudreau, Emile wrote:
    (snip)
    >> I have tried variations of: os.path.isfile( os.path.join("C:\\temp\\",
    >> "rqp-win32-app", "*.tar.gz"))


    As a side note, the whole point of os.path is to help writing portable
    code. So passing an os.specific path componant is somewhat counter
    productive !-)

    (snip answer)
     
    Bruno Desthuilliers, Mar 15, 2007
    #2
    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. Claudio Grondi
    Replies:
    4
    Views:
    589
    Claudio Grondi
    Aug 20, 2005
  2. 7stud

    os.path.isfile() error

    7stud, Apr 7, 2007, in forum: Python
    Replies:
    5
    Views:
    427
    Steve Holden
    Apr 7, 2007
  3. Replies:
    10
    Views:
    537
    Paul Paterson
    Jun 6, 2007
  4. 7stud

    os.path.isfile()

    7stud, Jul 1, 2007, in forum: Python
    Replies:
    2
    Views:
    476
    7stud
    Jul 1, 2007
  5. Replies:
    1
    Views:
    433
    Peter Otten
    Dec 30, 2010
Loading...

Share This Page