OSError - Directory exists so capture fails on startup
I have my RPi set to run the python script on autologin but it seems like when it isn't shut down properly with sudo shutdown "now", the next time I boot it up I get the following error.
File "raspiLapse.py", line 21, in <module> os.mkdir(folderToSave) OSError: [Errno 17] File exists: 'timelapse_201404060840"
How do I add code to check if the directory already exists, and if it does add an incremental number to the end of the new directory name? For example: "timelapse_201404060840_1"