By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

develop automated folder structure

P: 16
I want to desing a automated folder structure script, when given the name of the root folder, the children folders along with the root folder are created automatically.

The folder structure should be like this:

ParentFolder
--> 1. Child1 ==> GrandChild1, GrandChild2, GrandChild3
--> 2. Child2
--> 3. Child3

Only the name of the ParentFolder will be given by the user and other folders name will be hard coded.

How can I do it?

Please can any one help me, do any one have any snippets for this?
Mar 18 '14 #1
Share this Question
Share on Google+
1 Reply


bvdet
Expert Mod 2.5K+
P: 2,851
The os module provides all the functionality to do what you want. os.makedirs(file_path) will recursively create nested directories. os.path.join(path1 [,path2 [, ...]]) will intelligently joint one or more path components into a complete path name.
Mar 18 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.