Using glob (was Re: Remove files of same type (extension))

Oleg Broytmann phd at phd.pp.ru
Tue Sep 25 03:58:30 EDT 2001


On Tue, Sep 25, 2001 at 12:26:14AM -0400, Peter Hansen wrote:
> I just got caught, however, by my apparent lack of understanding of
> the phrase "according to the rules used by the Unix shell" from 
> the library reference info on glob.
> 
> glob.glob('*') returns all files *except* those that start with a period
> 
> glob.glob('.*') returns all files which do start with a period.
> 
> To use glob to get *all* files, one must do something like
> 
>   glob.glob('*') + glob.glob('.*')

   And this is exactly how UNIX shells do it.

Oleg.
---- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.




More information about the Python-list mailing list