I want to use the shutil.rmtree() to remove files from a scrap geodatabase. Before adding it to a stand alone script I tried it out in an interactive session and got two different results. The first time the code seemed to work fine. I ran it and opened arccatalog and all the files had been removed from the gdb:
clearfile = r"C:\RS_Data\Non_RS_MXDs\CO_002_Scrap.gdb" shuntil.rmtree(clearfile)
I then tested it on the next gdb and when I opened arccatalog this time the actual gdb had been deleted and the gdb from the previous excution is displayed in the catalog tree as a folder and not a gdb. I'm pretty sure I used the same syntax but here it is just in case:
clearfile = r"C:\RS_Data\Non_RS_MXDs\CO_059_Scrap.gdb" shutil.rmtree(clearfile)
I don't want the gdb deleted, just the files within as each time I run the script the last bit of code builds a new featureclass from merging other featureclasses in the scrap geodatabase created at the beginning of the script. Therefore the gdb needs to be empty at the beginning of the script or I will get unwanted featureclasses merged into the final output. Also, I don't want to create a new scrap gdb everytime I run the script.