โ09-08-2016 04:53 AM
I have a folder at location dbfs:/mnt/temp
I need to delete this folder. I tried using
%fs rm mnt/temp
&
dbutils.fs.rm("mnt/temp")
Could you please help me out with what I am doing wrong?
โ09-09-2016 09:29 AM
Hi nmud19,
What error did you get? Can you paste a stack trace?
You may need to make the path absolute and set recursive to true.
dbutils.fs.rm("/mnt/temp", true)
โ07-27-2017 02:38 PM
Or, to be more readable:
dbutils.fs.rm(fileprefix+".tmp",recurse=true)
โ02-14-2019 10:33 AM
dbutils.fs.rm("/mnt/temp",True)
The command above works in runtime 5.1 with python3
โ05-07-2019 04:15 PM
Since you're deleting a folder in the
/mnt
directory, I assume it was made when you mounted a data source. If that's the case, you can delete the folder using
dbutils.fs.unmount("/mnt/temp/")
โ07-23-2019 01:18 AM
I found the easier way out. It was getting this error all the time: TypeError: '/mnt/adls2/demo/target/' has the wrong type - class bool is expected. Googling helped a lot ๐
Remove files from directory after uploading in Databricks using research paper help in copying files using dbutils
โ12-08-2019 04:28 AM
try LongPathTool program
โ10-28-2020 09:15 AM
how do I delete multiple folders within a mount point ???
โ11-30-2020 12:16 AM
use this (last raw should not be indented twice...):
def delete_mounted_dir(dirname):
files=dbutils.fs.ls(dirname)
for f in files:
if f.isDir():
delete_mounted_dir(f.path)
dbutils.fs.rm(f.path, recurse=True)
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group