backup:展开文件路径中的通配符

python:

import glob
for input_file in glob.iglob(sys.argv[1]):
    for root, dirs, files in os.walk(input_file):
        for file in files:
            if file.endswith('.js') and not file.endswith('.min.js'):
                process_static_file(os.path.join(root, file))
            elif file.endswith('.css'):
                process_static_file(os.path.join(root, file))

php:

foreach (glob("*.txt") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
}

node.js:
https://github.com/isaacs/node-glob

var glob = require("glob")

// options is optional
glob("**/*.js", options, function (er, files) {
  // files is an array of filenames.
  // If the `nonull` option is set, and nothing
  // was found, then files is ["**/*.js"]
  // er is an error object or null.
})

加入讨论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.