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:ย 

extract latest files from ADLS Gen2 mount point in databricks using pyspark

pankaj92
New Contributor II

Hi Team,

I am trying to get the latest files from an ADLS mount point directory. I am not sure how to extract latest files ,Last modified Date using Pyspark from ADLS Gen2 storage account. Please let me know asap. Thanks!

I am looking forward your response.

4 REPLIES 4

pankaj92
New Contributor II

Hi Team,

can you please respond here. Thanks!

pankaj92
New Contributor II

Hi Team,

Can someone please respond here. If someone has already implemented. Thanks!

Sha_1890
New Contributor III

I am looking for the same too. Appreciate the speedy response.

Sha_1890
New Contributor III

Hi @pankaj92โ€‹ ,

I wrote a Python code to pick a latest file from mnt location ,

import os

path = "/dbfs/mnt/xxxx"

filelist=[]

for file_item in os.listdir(path):

  filelist.append(file_item)

file=len(filelist)

print(filelist[file-1])

Thanks

Connect with Databricks Users in Your Area

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