HP OpenVMS Systemsask the wizard |
The Question is: How can I within DCL get a directory listing equivalent to the UNIX command l -tr? That is to say a DCL way to get an oldest to newest files directory listing? The Answer is :
This is not directly available at the OpenVMS DCL prompt, though
tools such as Fileview can perform this task, and simple DCL
command procedures are available.
Attached are two variations. The first is rather shorter, but
displays the time in an unusual format. PIPE could also be used.
The DECUS "SOD" tool (V00473) may also be of interest here.
$define lib$dt_format lib$date_format_022
$direct/dat/wid=fil=40/out=sys$scratch:x.x 'p1
$sort/key=(pos=41,siz=10) sys$scratch:x.x tt:
$delete sys$scratch:x.x.
--
$direct/dat/wid=fil=40/out=sys$scratch:x.x 'p1
$sort/spec=sys$input sys$scratch:x.x tt:
/field=(name=filename,position:01,size:40)
/field=(name=year, position:50,size:4)
/field=(name=month, position:46,size:3)
/field=(name=day, position:43,size:2)
/condition=(name=jan,test=(month EQ "JAN"))
/condition=(name=feb,test=(month EQ "FEB"))
/condition=(name=mar,test=(month EQ "MAR"))
/condition=(name=apr,test=(month EQ "APR"))
/condition=(name=may,test=(month EQ "MAY"))
/condition=(name=jun,test=(month EQ "JUN"))
/condition=(name=jul,test=(month EQ "JUL"))
/condition=(name=aug,test=(month EQ "AUG"))
/condition=(name=sep,test=(month EQ "SEP"))
/condition=(name=oct,test=(month EQ "OCT"))
/condition=(name=nov,test=(month EQ "NOV"))
/condition=(name=dec,test=(month EQ "DEC"))
/key=year
/key=(if jan then 01
else if feb then 02
else if mar then 03
else if apr then 04
else if may then 05
else if jun then 06
else if jul then 07
else if aug then 08
else if sep then 09
else if oct then 10
else if nov then 11
else if dec then 12
else 13)
/key=day
/key=filename
$delete sys$scratch:x.x.
$ exit
|