A path is given and this path contains sub directories like
---- Folder1
---- Folder2
---- Folder3
etc.
I want to extract from each folder the first file and store it in a list and if possible remove that file also from that folder. I know how to do this by looping through folders and the respective files using os.listdir method but this process loads all the files in the memory.
And considering there are large number of files in each folder does anyone know an efficient way or method to loop through folders and extract the first file of each sub folder into a list.?