You can use the os module to recursively traverse through all the directories and subdirectories in the current directory and list all the files using the os.listdir() method. Here's a sample code to achieve this:
main.py175 chars9 linesIn the above code:
os.walk method is used to recursively traverse through all the directories and subdirectories in the current directory.for loop is used to iterate through all the files in each directory and subdirectory.os.path.join method is used to get the full path of each file.print statement is used to print the full path of each file.You can modify this code to suit your needs, such as storing the file paths in a list or writing them to a file.
gistlibby LogSnag