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: 

How to get the files with a prefix in Pyspark from s3 bucket?

User16826994223
Honored Contributor III

I have different files in my s3. Now I want to get the files which starts with cop_

1 REPLY 1

User16826994223
Honored Contributor III

You are referencing a FileInfo object when calling 

.startswith()

and not a string.

The filename is a property of the 

FileInfo

 object, so this should work

filename.name.startswith('cop_ ')

 should work.

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!