From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Wed May 23 2007 - 10:52:12 CDT

Hi Francois,
glob returns an unsorted tcl list, so you can apply the lsort command
(http://www.tcl.tk/man/tcl8.4/TclCmd/lsort.htm) to sort it however you
want. For example, the opening line of your loop could be

foreach filename [lsort -dictionary [glob *.mol2]] {
...
}

Best,
Peter

FyD wrote:
> Dear All,
>
> We load many .mol2 files located in the working directory using the
> following code in the .vmdrc file:
> =======================================
> proc test {} {
> set i 0
> foreach filename [glob *.mol2] {
> puts $filename
> mol new $filename type mol2 waitfor all
> molinfo top set drawn 0
> incr i 1
> }
> }
>
> test
> ========================================
> However, the order of display in vmd is really un-convenient, or at
> least do not follow the alphabetic order... This means when we use
> this method to load 50 or more mol2 files in vmd, we get totally lost
> to find a particular file we are interested in...
>
> Is there a way to force vmd to load a list of file using the
> alphabetic order ?
>
> by analogy the "ls -l *.mol2" and "ls -v *.mol2" provide very
> interesting output...
>
> Thanks, Francois
>