def GetS3CompatibleFileList(root, prefix=None):
 def _ListFiles(dir):
  for obj in os.listdir(dir):
   objpath = os.path.join(dir, obj)
   if os.path.isfile(objpath):
    (yield os.path.relpath(objpath, root))
   elif os.path.isdir(objpath):
    for f in _ListFiles(objpath):
     (yield f)
 filelist = [x for x in _ListFiles(root) if ((not prefix) or x.startswith(prefix))]
 return sorted(filelist)

def GetS3CompatibleFileList ( root , prefix = None ) : def _ListFiles ( dir ) : for obj in os . listdir ( dir ) : objpath = os . path . join ( dir , obj ) if os . path . isfile ( objpath ) : ( yield os . path . relpath ( objpath , root ) ) elif os . path . isdir ( objpath ) : for f in _ListFiles ( objpath ) : ( yield f ) filelist = [ x for x in _ListFiles ( root ) if ( ( not prefix ) or x . startswith ( prefix ) ) ] return sorted ( filelist )
returns a list of filenames from the local object store which emulates the sorting order of keys returned from an aws s3 file store .