Reputation: 2470
I have images in a sub-folder. Let's the folder images
I have a python program which will take image arguments from the folder one by one, the images are named in sequential order (1.jpg , 2.jpg, 3.jpg and so on).
The call to the program is : python prog.py 1.jpg
What will be a shell script to automate this ?
Please ask for any additional information.
Upvotes: 0
Views: 109
Reputation: 638
cd IMG_DIR
for item in [0-9]*.jpg
do
python prog.py $item
echo "Item processed : $item"
done
You can also pass image dir as a shellscript argument
Upvotes: 0
Reputation: 207425
You could do them all in parallel very simply with GNU Parallel like this:
parallel python prog.py ::: images/*.jpg
Or, if your Python writes to the current directory:
cd images
parallel python prog.py ::: *.jpg
Upvotes: 0
Reputation: 171
Try this from the folder that contains images/:
for i in images/*.jpg; do
python prog.py $i
done
Upvotes: 1