bash - How to sequentially execute a command on every file in a directory? -
i have directory i'm polling through cron new uploads , i'm running sequence of scripts on each upload.
one part of program retrieves image web using name of uploaded file.
the image saved generic name, image.png, gets sent next script more processing.
only 1 image made, if there 5 newly uploaded files 1 image still gets made.
how structure code/scripts full cycle of program have in 3 different scripts run on 1 file @ time, in other words loop through directory , run program on each file sequentially.
i'm trying preserve structure of 1 image file being made uploads being processed.
shopt -s nullglob file in /home/yt/box/moremusic/youtube/*; python /home/yt/ytimage.py $file; /home/yt/uploadyt; done; shopt -u nullglob
i tried script 3 files in /home/yt/box/moremusic/youtube/ , 1 image retrieved.
how can achieve goal or @ least in right path? or how can process of uploaded files in parallel , still have 1 image file.
try bash loop:
ls -1 | while read file; echo $file; done;
Comments
Post a Comment