(Feb-09-2020, 04:53 AM)jim2007 Wrote: Have a read of this, it should get you off the starting block in finding a list of files: https://realpython.com/working-with-files-in-python/
Thank you it was good read, I guess I don't have the experience or logic to read that kind of thing and apply to my case yet. Still waiting for a solution (lost hope already though)
Asked the same question on reddit, stackoverflow, python forum etc. Either the idea of helping others online is just vanished or helping others in programming is not similar to other practices. I have been a sound engineer for more than 13 years, I have spent countless hours helping newbies (including programmers) to solve their audio related problems. It's sad when you need the same help you can't find anyone to help.
I appreciate your help and interest again.
import os ''' For the given path, get the List of all files in the directory tree ''' def getListOfFiles(dirName): # create a list of file and sub directories # names in the given directory listOfFile = os.listdir(dirName) allFiles = list() # Iterate over all the entries for entry in listOfFile: # Create full path fullPath = os.path.join(dirName, entry) # If entry is a directory then get the list of files in this directory if os.path.isdir(fullPath): allFiles = allFiles + getListOfFiles(fullPath) else: allFiles.append(fullPath) return allFiles def main(): dirName = '/home/varun/Downloads'; # Get the list of all files in directory tree at given path listOfFiles = getListOfFiles(dirName) # Print the files for elem in listOfFiles: print(elem) print ("****************") # Get the list of all files in directory tree at given path listOfFiles = list() for (dirpath, dirnames, filenames) in os.walk(dirName): listOfFiles += [os.path.join(dirpath, file) for file in filenames] # Print the files for elem in listOfFiles: print(elem) if __name__ == '__main__': main()I guess this script now prints out all the files in my directory, including subdirectories. Now I gotta find out how to extract them all and I should be all set.