I have one folder with one geodatabase and two other files (txt). I used zip and zipped them. So now in this folder i have gdb, txt,txt, and new zip file. Now I need to delete those files that were zipped, so that will be only zip file in the folder. I wrote the following code:
def remove_files(): for l in os.listdir(DestPath): if l.find('zipped.zip') > -1: pass else: print ('Deleting ' + l) os.remove(l) But got:
Error Info: [Error 2] The system cannot find the file specified: 'geogeo.gdb' Can anyone help me?
l.find('zipped.zip') > -1you can simply use'zipped.zip' in l