I am trying to extract the file path from files stored in a directory. I am trying to only extract the first file in the directory and there by store it to a Dataframe.
I have the list of all directories in a list and would like to have that run over and fetch just the first file name.
list = [path1,path2,path3]
I have the below script that is able to fetch the path of all files in a particular directory.
list = bucket.list(prefix="path1")
for l in list:
keyString = str(l.key)
print(keyString)
The above code fetches path of all files in a single directory. I am trying to see how can I have the path info passed from the list and then iterate through each path and have the path of first file in each directory stored in a Dataframe.