- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: List the latest file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 04:01 AM
тАО05-08-2009 04:01 AM
Re: List the latest file
The default date & time formats
LIB$DATE_FORMAT_001
LIB$TIME_FORMAT_001
are defined in SYS$STARTUP:VMS$INITIAL-050_LIB.COM
You can define your own date and time format
in table lnm$dt_format_table and make use of it without running LIB$DT_STARTUP.COM
I think I'm right about this, but I'm not 100% sure.
Hakan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 04:30 AM
тАО05-08-2009 04:30 AM
Re: List the latest file
So for average users it is better to rely on definitions done from systartup_vms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 05:27 AM
тАО05-08-2009 05:27 AM
Re: List the latest file
Oppps....forgot about the privileges needed to
define names in lnm$dt_format_table.
The truth is that I have never worked without
privileges on VMS........ and have all privileges enabled by default.
I know...., but that's the way it is ;-)
Hakan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 08:05 AM
тАО05-08-2009 08:05 AM
Re: List the latest file
You're right. This came up in the Linux
forum:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1335784
After saying that it would be easy in DCL, I
figured that I ought to try it.
$! 8 May 2009. SMS.
$!
$! Find newest file in (wildcard) P1 specification.
$!
$ prev_file_spec = ""
$ date_max_c = f$cvtime( "17-NOV-1858 00:00:00.00", "COMPARISON")
$ file_spec_max = ""
$!
$ loop_top:
$!
$ file_spec = f$search( p1)
$!
$! Quit if out of files, or (non-wildcard) look-up repeats.
$!
$ if ((file_spec .eqs. "") .or. -
(file_spec .eqs. prev_file_spec)) then goto loop_end
$!
$ prev_file_spec = file_spec
$!
$! Get file revision date, and convert it to "COMPARISON" format.
$!
$ file_date = f$file_attributes( file_spec, "RDT")
$ file_date_c = f$cvtime( file_date, "COMPARISON")
$!
$! Save the information for a new newest file.
$!
$ if (file_date_c .gts. date_max_c)
$ then
$ file_spec_max = file_spec
$ date_max_c = file_date_c
$ endif
$!
$ goto loop_top
$ loop_end:
$!
$! If anything was found, display its information.
$!
$ if (file_spec_max .nes. "")
$ then
$ write sys$output file_spec_max
$ write sys$output date_max_c
$ endif
$!
Easy enough, I reckon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 10:10 AM
тАО05-08-2009 10:10 AM
Re: List the latest file
$ bash -c "ls -lt"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 10:40 AM
тАО05-08-2009 10:40 AM
Re: List the latest file
That gives me more than "the [...] file".
Or did you mean this?:
$ bash -c "ls -lt | head -2 | tail -1"
The DCL method runs faster, and easily does
recursive descent into subdirectories
("[...]"), which is tougher to do with a
UNIX-like method.
As usual, many things are possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-08-2009 11:31 AM
тАО05-08-2009 11:31 AM
Re: List the latest file
>>Or did you mean this?:
>>$ bash -c "ls -lt | head -2 | tail -1"
Yea right, thats exactly to get the one newest file, as Your DCL command file is doing.
I was just comparing the bash one liner to my dir_by_date.com .
- « Previous
-
- 1
- 2
- Next »