Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jgc

macrumors regular
Original poster
Feb 21, 2012
202
0
Canada
Hi there,

Bit of an odd problem I'm having that's very annoying but pretty harmless. I'm having a problem with the way Preview orders files (in my case images) when a large amount are opened.

So, here's the scenario. Say I have 10 pictures in a folder titled "1", "2" "3", ... "9", 10". Although intending to have these order normally when I bulk open them in Preview (1 through 10), it sees the "1" at the beginning of the "10" and puts it before 2. So then my photos will be ordered 1, 10, 2 through 9. It becomes a larger problem when I open folders with images ordered 1-100.

Is there any way to fix this? It's a bit of an odd problem so I've had no luck on Google yet, thought I'd try my hand here.

Best regards.
 
RE: sort -g...

Hi jgc,

Under unix, you can sort according to the general numeric value (sort -g) or according to the string numeric value (sort -n). I don't know how to get Preview to alter its sorting to the general numeric value, but I suspect that there is a plist somewhere in your Library Preferences directory that has a variable to change this behavior. Unfortunately, right now I don't have the time to track this down for you.

If you can't figure out how to change Preview's sorting, then you could always rename your files adding zeroes (000...) to the front of the names so that they are sorted correctly by Preview's sorting routine. This can be easily done using bash commands to sort the directory listing correctly (sort -g) and then move the resulting files (FOR statement) to a new name with zeroes tacked onto the beginning of the numerical names. In other words, "1.jpg" is renamed to "001.jpg", "2.jpg" becomes "002.jpg", and "10.jpg" becomes "010.jpg".

Good luck,
Switon
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.