Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am processing data and it is required to have same name of outputs [standard names] for different geographical regions. Therefore it is necessary to save outputs in different folders each time. Is there a way to create a folder with different name each time when i run script?

share|improve this question
up vote 5 down vote accepted

I'd recommend using the built in date module of python instead of random numbers. You won't have to worry about values being repeated, and the date tells you more about the file than any random number can.

Here's the Codecademy course for the Python date module -- it should have you up and running in no time.

from datetime import datetime

now =
day =
month = now.month
year = now.year

print str(day) + "_" + str(month) +"_"+str(year)
share|improve this answer
Thanks. Very good link about date module. I added time to differentiate all folders. – Ibe Nov 1 '12 at 12:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.