I am trying to create a script that will automate a Feature Class to Feature Class OR Feature Class to File Geodatabase Conversion. I want to save this in a folder as a back up once a week in case I lose my current data for any reason or need to revert to that download date. So far I have the following code just for the FC to FC operation, and am recieving the error that follows.:
import arcpy arcpy.env.workspace = "https://services.arcgis.com/T2graiaSQnlmwwmp/arcgis/rest/services/Target_Address_7_6_Backup/FeatureServer" arcpy.FeatureClassToFeatureClass_conversion("Target Address New", "C:\\Users\vmrenfor\Consumers Folders\VSR\BackupExports\VSR Back up\VSR Back up.gdb", "Target_Adrress_12_10_2018") Traceback (most recent call last): File "<string>", line 5, in <module> File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\conversion.py", line 860, in FeatureClassToFeatureClass raise e File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\conversion.py", line 857, in FeatureClassToFeatureClass retval = convertArcObjectToPythonObject(gp.FeatureClassToFeatureClass_conversion(*gp_fixargs((in_features, out_path, out_name, where_clause, field_mapping, config_keyword), True))) File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 496, in <lambda> return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Output Location: Dataset C:\Users mrenfor\Consumers Folders\VSR\BackupExports\VSR Back up\VSR Back up.gdb does not exist or is not supported Failed to execute (FeatureClassToFeatureClass).
Any thoughts on how I can fix this error would be appreciated. I would then like this to be run each subsequent week, naming the file "Target_Address_{Current Date}.
Thanks for the link!
Yes, I am specifying a feature service as the work space because that is where I want to pull from. The layer was created in AGO, so it does not reside in a geodatabase on my computer anywhere.
Unfortunately I don't have the "..." option. See my comment screen below.
Click on the question, and then reply. If you reply in your Inbox, you won't have that option.
You can use pure pythonic modules to get the current date as part of your script and then create a Windows Scheduled Task to run the operation. Just google date and python and you should get plenty of hits. There are also many Windows Scheduled Task geonet threads, so perform a keyword search on that in geonet.