Numerical file (photo) ordering when using Preview

Discussion in 'macOS' started by jgc, Jan 29, 2013.

  1. jgc macrumors regular

    Joined:
    Feb 21, 2012
    Location:
    Canada
    #1
    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.
     
  2. switon macrumors 6502a

    Joined:
    Sep 10, 2012
    #2
    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
     

Share This Page