Database Reference
In-Depth Information
todaydate = str(datetime.date.today().year) +
str(datetime.date.today().month) +
str(datetime.date.today().day)
os.rename (sgdb_path + "/" + sgdb_name , sgdb_path +
"/" + "Web_Bestaurants" + todaydate + ".gdb")
arcpy.CreateFileGDB_management(sgdb_path, sgdb_name)
3. Finally, run the command and make sure it works.
4. This step is optional; we could add this script in Windows Scheduler for it to run.
The following steps are necessary to do so:
1. From the Start menu, type taskschd.msc to open up Task Sched-
uler .
2. From the Actions panel, click on Create Basic Task... and type in the
name of the task, Web_Bestaurants_Backup , and then click on
Next .
3. Select Daily , so the task runs on a daily basis. Click on Next .
4. Select the time you want this task to run, leave it at midnight , and click
on Next .
5. Select Start a program and then click on Next . This way, we let Win-
dows start our script.
6. Browse to your web_bestaurants.py file.
7. Click on Finish .
Note
Note that if you have run the command multiple times, you will get an error. The
reason is that the geodatabase is created on the first run, so when you try to run
the script again it will create the geodatabase with the same name raising an error.
To solve that you can delete the geodatabase before running the script.
As shown in the following screenshot, Windows will now run your script on a
daily basis and create a copy of your Web_Bestaurants geodatabase:
Search WWH ::




Custom Search