Listing directorycontent in python

Bengt Richter bokr at accessone.com
Tue Jul 31 12:58:13 EDT 2001


On Tue, 31 Jul 2001 11:14:56 GMT, sill at optonline.net (Andrei Kulakov) wrote:

>On 30 Jul 2001 23:31:55 -0700, andreas <wpt2097 at hotmail.com> wrote:
>> 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.
>> 
>> TIA
>> 
>> Andreas
>
>os.dirlist(dirpath)
ITYM os.listdir(dirpath)
>




More information about the Python-list mailing list