I have a basic python code that is intended to take the contents of a File GDB and ZIP them (not that actual .gdb itself though). When I test the code it says it's all good. When I run the code however, it goes straight to "Exit Code 0" and nothing happens. No new ZIP file, nothing. Any ideas where I'm going wrong?
# Creates a zip file containing the input shapefile
# inFileGDB: Full path to FileGDB folder to be zipped
# Delete: Set to True to delete fileGDB files after zip
# Creates a zip file containing the contents of a filegeodatabase
def Zipfgdb(inFileGDB = r'\\my\data\pathway\MyData.gdb', Delete = 'False'):
print inFileGDB + " : Delete original files = " + Delete
#Directory of file geodatabase
inLocation = os.path.dirname (inFileGDB)
print "inLocation: " + inLocation
#Base name of shapefile
inName = os.path.basename (os.path.splitext(inFileGDB))
print "inName: " + inName
#Create the zipfile name
zipfl = os.path.join (inLocation, inName + ".zip")
print "New ZIP file: " + zipfl
#Create zipfile object
ZIP = zipfile.ZipFile (zipfl, "w")
print "ZIP file created"
#Iterate files in shapefile directory
for fl in os.listdir (inFileGDB):
#Get full path of file
inFile = os.path.join (inFileGDB, fl)
#Add file to zipfile. exclude any lock files
if os.path.splitext(fl)[1:] <> 'lock':
print "files added to ZIP file"
#Delete filegeodatabase if indicated
if Delete == True:
print "Original file deleted"
#Close zipfile object
#Return zipfile full path