I am trying to find all .js files in directories and gives it as arguments to python. I could collect all the files with .js using bash command find . -name "*.js"
, but I don't know how to give these information to python. I don't want to send file name one by one. I want to send as a list the python code that handling arguments is following.
import argparse
argparser = argparse.ArgumentParser("sh test")
argparser.add_argument("js_file", type=str, nargs ="+", help="js file names")
args = argparser.parse_args()
for file in args.js_file:
# do something