Caution: . Any files matching the template will also be selected anywhere under the root folder, which is the / nodes.
import os, fnmatch
def locate(pattern, root_path):
for path, dirs, files in os.walk(os.path.abspath(root_path)):
for filename in fnmatch.filter(files, pattern):
yield os.path.join(path, filename)
os.walk , , .
js_assets = [js for js in locate('*.js', '/../../nodes')]
locate , .
: glob, glob.
, :
fnmatch.filter( glob.glob('/../../nodes/*/views/assets/js/**/*'), '*.js' )