Listing directorycontent in python

Steve Holden sholden at holdenweb.com
Tue Jul 31 07:29:22 EDT 2001


"andreas" <wpt2097 at hotmail.com> wrote in message
news:1aa68e6e.0107302231.dd024a2 at posting.google.com...
> Hello.
>
> I have a simple question, I want to have a list of all files/dirs in a
> certain directory.
>
> An example would be that I want to know all filenames that end with
> "*.JPG" in the directory "/var/www/".
>
> I have not succeeded in doing this myself with "os.path"-module, so I
> am now asking for tips, hints, examples or pointers to answers of
> previous similar posts.
>
> I am using Python v1.5 most of the time.
>
The "glob" module will do what you want, and is fine in 1.5.2. In fact I
needed the same thing for a program of my own. See "photoclip.py" on

    http://www.holdenweb.com/Python/index.html

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list