[ Brought back on list, since Jon is very correct. - Cameron ]
On 30Jan2018 05:09, Jon LaBadie <jon(a)jgcomp.com> wrote:
On Tue, Jan 30, 2018 at 08:53:32PM +1100, Cameron Simpson wrote:
> Run a small shell script like this (untested, but happy to help debug):
>
> cd your-staging-directory
> n=1
> while :
> do
> 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"
> done
> sleep 1
> done
I think all the files will be named 00001-<orig_name>
When there is no name collision you skip the increment.
Yes. Need to increment after the "mv" as well. Good call.
Thanks,
Cameron Simpson <cs(a)cskk.id.au> (formerly cs(a)zip.com.au)