3

I'm very new to this, Im essentially trying to create a script for working on feature films so that everyday I can have a new set of folders made for that specific shoot day that I can the offload files too.

So far I have been able to have a Folder made with the users input of which shoot day they are on and then add the actual date to that file name.

But where I am stuck is trying to add folders within this newly created folder.

print ('')
print '\033[4m' + "Hello, Please select a shoot day to begin - this only works up until 12pm" + '\033[0m'
import os
import sys
import time, datetime

today = datetime.date.today()  # get today's date as a datetime type

todaystr = today.isoformat()   # get string representation: YYYY_MM_DD
                               # from a datetime type.


print('')
user_input = raw_input('\033[1m' + 'Enter Shoot Day Here -' + '\033[0m')

path1 = user_input
if not os.path.exists(path1):
    os.makedirs(path1 +'_' + todaystr)

So this created me a folder called 015_2016-12-24. I then want to be able to add several folders with folders inside of these folders.

Just trying my best here sorry if this is a dumb question. Thanks for any help !

1 Answer 1

4
os.makedirs(path1 +'_' + todaystr+'/'+name of subfolder)

this will allow you to create subfolder for your newly created folder

Sign up to request clarification or add additional context in comments.

2 Comments

Okay perfect, I knew it would be something simple. But then how would I go about adding more than one folder at a time ? Lets says I wanted to create 3 folders called 'ari' 'sound' and 'md5' and wanted them to all be in that top folder? Simply adding - os.makedirs(path1 +'_' + todaystr+'/ari'+'sound') Would just made the folder name 'arisound" right ?
@JonathanPetts for name in ['ari' , 'sound', 'md5']: os.makedirs(path1 +'_' + todaystr + name). This will create three subfolders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.