cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a utility to convert between "/dbfs" and "dbfs:" path strings?

fijoy
Contributor

Is there a built-in utility function, e.g., dbutils, that can convert between path strings that start with "dbfs:" and "/dbfs"?

Some operations, e.g, copying from one location in DBFS to another using dbutils.fs.cp() expect the path starting with "/dbfs", whereas others, e.g., copying from DBFS to S3 using dbutils.fs.cp() expect DBFS path strings to start with "dbfs:".

A built-in utility function to convert between these paths strings will be helpful.

3 REPLIES 3

Ajay-Pandey
Esteemed Contributor III

Hi @Fijoy Vadakkumpadan​ ,

You can use lstrip built-in function to remove this.

image.png

Thanks, but not what I'm looking for. I was looking for a built-in function to go from "/dbfs/hello/test" to "dbfs:/hello/test"

Anonymous
Not applicable

Hi @Fijoy Vadakkumpadan​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.