filesystem.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import os
00004 import fnmatch
00005 import glob
00006 
00007 def expand_path_to_filelist(path):
00008     recursive_path_split = path.split('/**/')
00009     if len(recursive_path_split) == 2:
00010         files = [os.path.join(dirpath, f)
00011                 for dirpath, dirnames, files in os.walk(recursive_path_split[0])
00012                 for f in fnmatch.filter(files, recursive_path_split[1])]
00013     else:
00014         files = glob.glob(path)
00015     
00016     for file in files:
00017         if not os.path.isfile(file):
00018             raise ValueError('path %s expanded to include %s, which is not a file' % (path, file))
00019 
00020     return files


bwi_tools
Author(s): Piyush Khandelwal
autogenerated on Fri Aug 28 2015 10:14:29