[Tutor] OS lib creating an directory using an absolute path.

Michael Deslippe 1611kjb at gmail.com
Sat Feb 6 09:06:13 EST 2021


I would direct you to this article: http://www.compciv.org/practicum/shakefiles/a-creating-a-directory-idempotently/


---Mike
________________________________
From: Tutor <tutor-bounces+1611kjb=gmail.com at python.org> on behalf of mhysnm1964 at gmail.com <mhysnm1964 at gmail.com>
Sent: Saturday, February 6, 2021 5:33:26 AM
To: tutor at python.org <tutor at python.org>
Subject: [Tutor] OS lib creating an directory using an absolute path.

All,



I am using the os library. If I have a directory structure with any missing
directory (folders), then the os.mkdir function fails as it cannot find the
filenamefilename. For example:



Current directory structure is:



C:\books  with nothing inside.



The path I am wanting to create is:



E:\books\a\anne rice



Yes, I could break the path and check each level of the directory. But I was
wondering if there was any other method to do this. As if you do this at
Windows 10 command line:



Mkdir E:\books\"a\anne rice"



The 'a' directory plus 'anne rice' is also created.



I hope this makes sense. Python 3.8 under windows 10.



Sean

_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list