cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Databricks Magic Command

Wolverine
New Contributor III

I am trying few commands 

what is the equivalent magic command of 

dbutils.fs.rm("dbfs:/sampledir",True)
 

Actually I am looking how to use magic commands in same way as dbutils  . For Instance 

 dbutils.fs.head('dbfs:/FileStore/<<name>>.csv',10) Gives 10 bytes  I am looking for magic command like how to give second parameter   %fs head dbfs:/FileStore/hotel_data.csv 10(If we give upto 10) it works but when we pass second one like 10 it will not give output like 10 bytes as above 
3 REPLIES 3

Giri-Patcham
New Contributor III
New Contributor III

@Wolverine Try %fs rm -r sampledir 
to delete recursively

Ok Actually I am looking how to use magic commands in same way as dbutils  . For Instance 

 dbutils.fs.head('dbfs:/FileStore/<<name>>.csv',10) Gives 10 bytes  I am looking for magic command like how to give second parameter   %fs head dbfs:/FileStore/hotel_data.csv 10(If we give upto 10) it works but when we pass second one like 10 it will not give output like 10 bytes as above 

Witold
New Contributor II

You could use shell commands, like

 

%sh rm -r sampledir

 

You need to check for the correct path before, I currently don't know where dbfs folders are exactly mounted

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!