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.
从包含images /的文件夹中尝试以下操作:
for i in images/*.jpg; do python prog.py $i done
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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.