find files their name is smaller or greater than a given parameter
        Posted  
        
            by 
                Tzury Bar Yochay
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Tzury Bar Yochay
        
        
        
        Published on 2011-03-09T09:00:08Z
        Indexed on 
            2011/03/09
            16:12 UTC
        
        
        Read the original article
        Hit count: 283
        
Say that in a given directory I got
tzury@x200:~/Desktop/sandbox$ ls -l
total 20
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P000
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P001
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P002
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P003
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P004
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N01.P000
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N01.P001
drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N01.P002
I seek for a bash way to grab the list of files which their name is either grater or smaller than a given parameter, for instance:
$ my_finder lt N00.P003
shall return N00.P000,  N00.P001 and N00.P002
$ my_finder gt N00.P003
shall return N00.P004, N01.P000, N01.P001 and N01.P002
I was thinking of iterating over for name in $(ls) and while $name != $2 but believe there are more elegant way of doing so
© Server Fault or respective owner