Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: os.path.isfile with *.tar.gz

Reply
Thread Tools

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

 
 
Steve Holden
Guest
Posts: n/a
 
      03-15-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.

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

 
Reply With Quote
 
 
 
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      03-15-2007
> 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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments