Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import *
- #GetFileList Pseudo-code:
- #List Target Directory, Check each file, if is directory, Call This function storing return value in its current return value. when all done return the current list
- #that contains directory contents. Do not store directories, only files. if is a directory remove it from list so it isn't in there.
- def ListFiles(target_directory = "./", excluded_filenames=[]):
- fileList = listdir(target_directory)
- for tmpFileLocation in range(0,(len(fileList)-1)):
- if (fileList[tmpFileLocation] in excluded_filenames):
- fileList.pop(tmpFileLocation)
- continue;
- if (path.isdir(fileList[tmpFileLocation])):
- for tmpFile in ListFiles(target_directory+fileList[tmpFileLocation]+"/"):
- fileList.append(fileList[tmpFileLocation]+"/"+tmpFile)
- fileList.pop(tmpFileLocation) #Was a directory get rid of it, we only want files in this list
- return fileList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement