@Ethin os.walk is indeed recursive. @1, basically when you loop through output from os.walk, you are getting a list with 3 items in it. This is usually represented by something like for root, dirs, files in os.walk(directory). However you can also execute for i in os.walk(directory) to get the above mensioned list. The first item, or root, is the root of the directory currently being walked. The second element or dirs, is a list of directories in the folder being walked, and the 3rd element, or files, is a list of files in the current directory being walked. So for example if you walk through documents and you have a folder called music within your documents folder, as well as a file called school_report.txt, and in the music folder you have a file called track1.mp3, the first iteration of the loop will give you the list ["documents", ["music"], ["school_report.txt"]]. Then music being the only directory, the next iteration will give you the list ["documents\\music", , ["track1.mp3"]]. So yes os.wwalk will automatically scan subfolders, just to clear up that confusion. If you wish to scan a directory non recursively, you can use the os.listdir function, which simply returns a list of the files and the directories of the folder you give it. To see whether something is a directory or a file, you will have to call os.path.isdir and os.path.isfile on each item indivisually. Usually os.walk is the way to go!
I am a web designer, and a game developer. If you wish see me at http://www.samtupy.com