'''
    For the given path, get the List of all files in the directory tree 
'''
import os

import sys
[sys.path.append(i) for i in ['.', '..']]


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 = './../originalPics';
    
    # Get the list of all files in directory tree at given path
    listOfFiles = getListOfFiles(dirName)
    
    # Print the files
    print(len(listOfFiles))
    with open('image.txt', 'w') as f:
        for item in listOfFiles:
            f.write("%s\n" % item)

    # 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()
a69822f4b36bca173f36a5edb3950c4662a81c7f
<mask token>


def getListOfFiles(dirName):
    listOfFile = os.listdir(dirName)
    allFiles = list()
    for entry in listOfFile:
        fullPath = os.path.join(dirName, entry)
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
    return allFiles


<mask token>

<mask token>


def getListOfFiles(dirName):
    listOfFile = os.listdir(dirName)
    allFiles = list()
    for entry in listOfFile:
        fullPath = os.path.join(dirName, entry)
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
    return allFiles


def main():
    dirName = './../originalPics'
    listOfFiles = getListOfFiles(dirName)
    print(len(listOfFiles))
    with open('image.txt', 'w') as f:
        for item in listOfFiles:
            f.write('%s\n' % item)
    print('****************')


<mask token>

<mask token>
[sys.path.append(i) for i in ['.', '..']]


def getListOfFiles(dirName):
    listOfFile = os.listdir(dirName)
    allFiles = list()
    for entry in listOfFile:
        fullPath = os.path.join(dirName, entry)
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
    return allFiles


def main():
    dirName = './../originalPics'
    listOfFiles = getListOfFiles(dirName)
    print(len(listOfFiles))
    with open('image.txt', 'w') as f:
        for item in listOfFiles:
            f.write('%s\n' % item)
    print('****************')


if __name__ == '__main__':
    main()

<mask token>
import os
import sys
[sys.path.append(i) for i in ['.', '..']]


def getListOfFiles(dirName):
    listOfFile = os.listdir(dirName)
    allFiles = list()
    for entry in listOfFile:
        fullPath = os.path.join(dirName, entry)
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
    return allFiles


def main():
    dirName = './../originalPics'
    listOfFiles = getListOfFiles(dirName)
    print(len(listOfFiles))
    with open('image.txt', 'w') as f:
        for item in listOfFiles:
            f.write('%s\n' % item)
    print('****************')


if __name__ == '__main__':
    main()

'''
    For the given path, get the List of all files in the directory tree 
'''
import os

import sys
[sys.path.append(i) for i in ['.', '..']]


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 = './../originalPics';
    
    # Get the list of all files in directory tree at given path
    listOfFiles = getListOfFiles(dirName)
    
    # Print the files
    print(len(listOfFiles))
    with open('image.txt', 'w') as f:
        for item in listOfFiles:
            f.write("%s\n" % item)

    # 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()