Check for presence fo directory

Robert Brewer fumanchu at amor.org
Fri Sep 24 05:24:28 CEST 2004


Maurice LING wrote:
> Hi, I'm looking for a way to check the presence of a 
> directory, such as, 
>   finddirectory(d), where d is the full directory path. Or is 
> the only 
> way  is to use os.listdir() to get the directory list and 
> test for the 
> presence of the directory I want before creating one?

Should we assume you're rejecting os.path.exists() for some reason?

> What will happen if I try to create a directory that is 
> already present?

I tend to find an exception is raised in those cases.


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list