Question as in title and here's the method:
def walkThroughPath(self , sBasePath, blFolders = True, blFiles = True ):
aPaths = []
for sRootDir, aSubFolders, aFiles in os.walk( sBasePath ):
for sFolder in aSubFolders:
if blFolders == True:
aPaths.append( sRootDir )
for sFileName in aFiles:
if blFiles == True:
aPaths.append( sRootDir + "/" + sFileName )
return aPaths
The method returns a big amount of subfolders and files but definetly not all that I've found.
What's wrong with my method (or is it a wrong usage of os.walk)?
For those who are interested in the Background:
http://www.playonlinux.com/en/topic-10962-centralized_wineprefix_as_preparation_for_debpackages.html
both of your hints brought the final solution that looks like that now:
First I indented incorrectly as Steven said.
os.walk seems to handle the lists not as I expected them to be. Folders of files not nessessarily appear in folders list. This caused many folders I left out just because those folder pathes have been in the files list. Additionally I only checked files only in this limited folders list.
Next I added the follow symlinks flag optional as unutbu suggested. Maybe in my case they could be needed as well eventually.
Those method above is surely a candidate for improvement, but it's at least working :-)
Best,
André