0

This question already has an answer here:

I have a folder of images that are numbered. ls returns them in order of most significant digit instead of numerical order.

enter image description here

as a result comands like convert *.jpg out.pdf creates pdf in this order. can this behavior be changed?

marked as duplicate by muru, Stephen Kitt, user4556274, Kusalananda Sep 4 at 18:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Note that the shell sorts its expansion of *.jpg lexically (though see the numericglobsort option in zsh, which you can also set on a per-glob basis with the n glob qualifier like *.jpg(n)) and ls also sorts the list of files it displays (unless you pass the -U option with GNU ls). – Stéphane Chazelas Sep 4 at 19:23
  • 1
    The title of this question is about ls (and it is tagged [ls]), but the body of the question is about convert *.jpg, so Glob with Numerical Order is a better duplicate. – G-Man Says 'Reinstate Monica' Sep 4 at 21:16
  • 1
    The old farts like me name our files with leading zeros (001, 002, etc) for exactly this reason. – stolenmoment Sep 4 at 22:49

Browse other questions tagged or ask your own question.