1

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
  • 329
  • 1
  • 5
  • 8

2 Answers2

5

os.makedirs()

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

sshannin
  • 2,687
  • 1
  • 19
  • 25
1

os module:

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

docs

Pill
  • 3,975
  • 1
  • 21
  • 26