On Wed, 2018-01-31 at 07:45 +1100, Cameron Simpson wrote:
Another untested version with a fix for his bug and a fix for the
sleep thing:
cd your-staging-directory
n=1
while :
do
moved=
for f in *.jpg
do
[ -s "$f" ] || continue
while :
do
target=$( printf 'your-ordered-directory/%05d-%s' "$n"
"$f" )
[ -e "$target" ] || break
n=$((n+1))
done
mv "$f" "$target"
n=$((n+1))
moved=1
done
[ $moved ] || sleep 0.1
done
See how that logic feels to you.
Just an update on this. I tried a lightly-modified version of your
script and got it to work. However as it stands it will only work
correctly if I deal with all the files in a set in one run, and don't
change my mind later about the order I want (i.e. the only way to do so
is to restore the original names and start over).
I'll keep thinking about it in any case. Thanks for your suggestions
(and ditto to Kenny and Rick among others who tried to help).
poc