1

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?

Mogsdad
46k21 gold badges167 silver badges290 bronze badges
asked Oct 27, 2015 at 23:55
1
  • 1
    Sounds like a pretty simple case for a for command. Commented Oct 27, 2015 at 23:56

1 Answer 1

3
for file in /path/*
do
 python main.py "$file"
done
answered Oct 27, 2015 at 23:59
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.