On Tue, 2018-01-30 at 20:53 +1100, Cameron Simpson wrote: > 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 > > That does a "mv", so give it a good test on copies first to avoid it eating > your files! On second thoughts, I don't think this is going to work: > Then just drag images into the staging directory in the right order and the > shell script will move them into the ordered directory with nice numeric > prefixes. Dragging the files 'in the right order' doesn't affect their names. The script loops over the files in lexical order, not in the order I've dragged them, so the final order won't change. To be clearer, this is an example directory listing: $ ls -l total 7388 -rwxr--r--. 1 poc poc 1036281 Jan 29 11:38 20180129113839_01.jpg -rwxr--r--. 1 poc poc 1183695 Jan 29 11:38 20180129113839_02.jpg -rwxr--r--. 1 poc poc 1133299 Jan 29 11:38 20180129113839_03.jpg -rwxr--r--. 1 poc poc 1066885 Jan 29 11:38 20180129113839_04.jpg -rwxr--r--. 1 poc poc 879477 Jan 29 11:38 20180129113839_05.jpg -rwxr--r--. 1 poc poc 1247414 Jan 29 11:38 20180129113839_06.jpg -rwxr--r--. 1 poc poc 1008515 Jan 29 11:38 20180129113839_07.jpg The filenames are generated from the scanning software (a commercial program running on a Windows VM, and beyond any possibility of modifying). Clearly these names are just timestamps plus a sequence number and represent the order the slides were scanned. Adding another index number via the Shell script isn't going to change this sequence. Currently the only recourse (apart from renaming each file manually) is to upload the slides to the gallery (Google Drive) one by one in the order I want. The gallery will then preserve that order. The problem is that there are thousands of them (not completely random but organised in boxes, which may have been shuffled over the years). What I'd prefer to do is to at least order each box locally and then do a per-box upload to the gallery. Sorry if I wasn't clear enough in my initial post. poc _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx