Forum Discussion
JP8991
1 year agoKudo Commander
Really strange issue - os.listdir
Hey all, Could you kindly look at the below, I have a really weird one where I am referencing a location within my files area of a Lakehouse however sporadically it does not work, I have no idea ...
JP8991
1 year agoKudo Commander
Xplor is a directory.
Brunovs79_cimen
1 year agoNew Member
In this example, I use the notebookutils to loop through the files in a dir and get only the name without the extension.
from notebookutils.fs import ls
from notebookutils.fs import ls
import os
application_path = 'abfss://#########@onelake.dfs.fabric.microsoft.com/000000000000/Files/folder/'
files_list = []
for file in ls(os.path.join(application_path,'excel_files_from_anp')):
file_name = file.name
if file_name.endswith('.xlsx'😞
files_list.append(file_name.split('.')[0])
for some reason os.listdir doesn't work in a pipeline or with abfss path.
Also ls is not allowed to return or anything or become an object.
for some reason os.listdir doesn't work in a pipeline or with abfss path.
Also ls is not allowed to return or anything or become an object.
print the dir of file and you will see some properties like name, size...