Update : Got this one working with the below script
if mssparkutils.fs.exists(folder_path):
mssparkutils.fs.rm(folder_path, True)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I have an external delta table that I have to recreate every time when my Synapse PySpark notebook is executed. Since this is an external table, I need to clean up the folder also before dropping the table. I am able to delete the folder using the below code but this fails if the folder is not present.
mssparkutils.fs.rm(<folder>, True)
I am looking for a code snippet which would look for the existence of this folder and deletes it recursively if present. Could you please help? Thanks, Alok
Update : Got this one working with the below script
if mssparkutils.fs.exists(folder_path):
mssparkutils.fs.rm(folder_path, True)