Hi , I have a question ..
I would like to write/modify the my program ... i.e
writing a function to find out which of the directories exists .....
for example : on my computer c:\\sam and in another mechine c:\\xyz ...
only one dir should on my computer or another computer.

1. check for the each of the directories
2.if they do fine , and if they dont create and retest for them.

please let me know how to do this ..
thanks in adv

regards
sam

Hi , Thanks for the reply.
I am new to Python , could you pls have a sample program..
I will be very thankful to you.

Regards
Sam

Surely you have not tried to write your own, in the 5 minutes from my last post. Write some code, try it, if it doesn't work, post it and then we can help you more.

thanks for your suggestion. I am not a python programmer , I am just very new as i said in the post.

Here's an example:

import os

my_path = 'C:\\sam'

if os.path.isdir( my_path ):
    print 'C:\\sam is a valid path'
else:
    os.makedirs( my_path )
    if not os.path.isdir( my_path ):
        print 'Path creation failed'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.