os.path.isfile with *.tar.gz

Steve Holden steve at holdenweb.com
Thu Mar 15 20:48:25 CET 2007

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.

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

More information about the Python-list mailing list