Here is an example of how to get a file list from an assigned directory recursively.
import sys, shutil, os, re
def list_file(root_dir):
obj = []
for root, dirs, files in os.walk(root_dir):
for file in files:
if file.endswith('.py') or file.endswith('.cgi') :
full_obj = os.path.join(root,file)
obj.append(full_obj)
return obj
def main():
sRootDir = "/home/username"
aFileList = list_file(sRootDir)
if __name__ == '__main__':
main()