3

Assume I only have the folder /root, with no subdirectories. Is there an easy method in python to create all directories for the following (in one line) /root/a/b/c/d/e/f/g/foo.exe?

coffee
  • 401
  • 2
  • 6
  • 8

2 Answers2

6

os.makedirs()

http://docs.python.org/library/os.html#os.makedirs

sshannin
  • 2,767
  • 1
  • 22
  • 25
2

os module:

os.makedirs('/root/a/b/c/d/e/f/g/')

docs

Pill
  • 4,815
  • 1
  • 24
  • 26