akira
akira

Reputation: 531

Bash script to execute a Python program

I am trying to write a bash script which can get all the file names from a folder and execute another Python script which takes one file name at a time.

How do I do that?

Upvotes: 1

Views: 49

Answers (1)

stanleyli
stanleyli

Reputation: 1477

for file in /path/*
do
  python main.py "$file"
done

Upvotes: 3

Related Questions