Article 167264 of comp.os.vms:
In article <334AE4E8.146@meriter.com>, scott vieth <svieth@meriter.com> writes:
>Hi:
>
>Say I've got a number of files in a certain directory.  How would I
>print them in the order the order that they were created?
>
>I've tried doing a DIR/DATE/OUT=list.out and then running SORT against
>the list of files but good old SORT likes to sort the month
>alphabetically (APR,AUG,DEC,JUL,etc.).
>
>Is there a quick-and-dirty DCL trick to print files in the order that
>they were created?
>
>-Scott Vieth svieth@meriter.com
>Meriter Hospital/Physicians Plus Medical Group

	and here is a .COM file that will do just that. Have fun...

$!---------------------------------------------------------------------------
$!
$!	Produce directory from most recent files to least.
$!
$!	Usage:
$!
$!		@tdir.com     which-directory
$!
$!	Gives listing of files from most recent to least, including
$!	all files in which-directory.  If which-directory not specified,
$!	"SYS$LOGIN_DEVICE:[yourself...]" is assumed.
$!
$!	Author:   Eric Osman   26-Feb-1991
$!
$!	Useful additions for future:
$!
$!	o	Allow choice of most recent or least recent
$!
$!	o	Allow choice of how many files are listed
$!
$!	Known restriction:
$!
$!	o	If entire name is too long, the sorting won't be right.
$!
$ set = "set"
$ on = "on"
$ on control_y then exit	! so symbols come back
$ set symbol/scope=(nolocal,noglobal)
$ on warning then exit
$ q = "sys$scratch:''f$getjpi("","pid")'"
$ home_device = "sys$login_device:"
$ home_dir_str = f$parse("sys$login:",,,"directory") - "[" - "]"
$ home_tree = "''home_device'[''home_dir_str'...]"
$ which_dir = p1
$ if which_dir .eqs. "" then which_dir = home_tree
$ dir 'which_dir'/col=1/wid=file=55/out='q'.out/nohead/notrail/date
$ sort 'q'.out sys$output:/spec=sys$input
/collating_sequence=
    (
    sequence=("AN","EB","AR","PR","AY","UN","UL","UG","EP","CT","OV","EC",
    " ","0"-"9"),
    fold
    )
			! second and third letters of each month

/field=(name=year,pos:65,size:4)
/field=(name=month,pos:62,size:2)	! start at SECOND letter
/field=(name=day,pos:58,size:2)
/field=(name=time,pos:70,size:11)
			! assume "14-OCT-1986 09:14:46.00" at position 58
/key=(year,descending)
/key=(month,descending)
/key=(day,descending)
/key=(time,descending)
$ delete 'q'.out.
$!---------------------------------------------------------------------------


