- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: How to find latest created file in VMS ?
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
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
тАО01-04-2008 01:46 AM
тАО01-04-2008 01:46 AM
How to find latest created file in VMS ?
There are numbers of files created in a directory (inside sub directories also) every day. How to find the last file created in this directory as I want to see the time, the file has been created. Please suggest the command to get it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 03:33 AM
тАО01-04-2008 03:33 AM
Re: How to find latest created file in VMS ?
- qualifier on DIR is a long wished addition to the DIR command....
As long as it doen't exits, yopu'll have to do it by a command procedure. A simple SORT on date on a DIR output file won't do the job since all dates will be displayed in VMS format (dd-MMM-yyyy hh:m:ss.ccc) which is not a format easy to sort...
A quick hack (not tried)
Either prepare DIR/DATE/OUT=
OpenVMS Developer & System Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 03:45 AM
тАО01-04-2008 03:45 AM
Re: How to find latest created file in VMS ?
http://vms.process.com/scripts/fileserv/fileserv.com?LWW-DIRSORT
WG
OpenVMS Developer & System Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 03:47 AM
тАО01-04-2008 03:47 AM
Re: How to find latest created file in VMS ?
Check http://www.quadratrix.be/products.html, if it suits your needs.
regards Kalle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 04:24 AM
тАО01-04-2008 04:24 AM
Re: How to find latest created file in VMS ?
So for Unix it is cheap, but for OpenVMS it was considered too expensive (1 IO per file) to give an easy sort by. Of course the end result was that many folks spend energy sorting poorly where directory could have done it better. Expensive, but better.
Anyway...
You can tell sort a magic collating sequence to get the (english) months right.
See old topic (1996) in c.o.v
http://groups.google.com/group/comp.os.vms/search?hl=en&group=comp.os.vms&q=hein+collating_sequence
Or more recently here:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1095459
And finally, here is a perl 'one liner':
$ perl -e "while (<*.tmp;*>) { $f{$_}=-M } foreach $x (sort {$f{$b}<=>$f{$a}} keys %f){ print qq($x\n)}"
That was sorted on modification date, new to old. For new to old switch the $a and $b around.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 06:00 AM
тАО01-04-2008 06:00 AM
Re: How to find latest created file in VMS ?
If you just want to see the last file, then doign the x=F$SEARCH + F$FILE(x,"CDT") preferable over sort.
For example:
$ file = F$SEARCH("[...]*.tmp;*")
$ last = ""
$loop:
$ this = F$CVTIME(F$FILE(file,"CDT"))
$ IF this.GTS.last
$ THEN
$ most_recent = file
$ last = this
$ ENDIF
$ file = f$search("[...]*.bas;*")
$ IF file .NES. "" THEN GOTO loop
$ WRITE sys$output most_recent, " ",F$FILE(most_recent,"CDT")
In perl it could look something like:
perl -e "$M=9999; while (<[...]*.bas;*>) { $m = -M; if ($m<$M) {$M=$m; $f=$_}} print qq($f\n)"
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 06:51 AM
тАО01-04-2008 06:51 AM
Re: How to find latest created file in VMS ?
There is a way to do this without a lot of fuss. It does involve the use of the DIRECTORY and SORT commands, and it does require a short preparatory step.
Check for the presence of logical name table table LNM$DT_FORMAT_TABLE (e.g., do a SHOW LOGICAL /TABLE=LNM$DT_FORMAT_TABLE). If this table does not exist, request that the system manager include the command file SYS$STARTUP:LIB$DT_STARTUP.COM in the startup sequence (personally, my preference is to use the SYSMAN STARTUP database to do this, but one can also include it in SYS$MANAGER:SYSTARTUP_VMS.COM).
Then, before doing the DIRECTORY command, follow the instructions in the LIB Run Time Manual for selecting the apppropriate date/time format (recommendation: YearMonthDay HourMinuteSecond Hundredth) and do the DIRECTORY/OUTPUT/NOHEAD/NOTRAIL followed by the appropriate SORT command).
The date/time formatting support is quite extensive, and for that matter, extensible to support the multitude of national date/time formats. It is also possible do define one's own format, for processing purposes.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2008 07:10 AM
тАО01-04-2008 07:10 AM
Re: How to find latest created file in VMS ?
$ define lib$dt_format LIB$DATE_FORMAT_037,LIB$TIME_FORMAT_001
but that is a kludge at best.
And there is QDSB that is similar in concept to RSX's SRD sorting features (doesn't have the ability to display files that would be deleted by a purge/ver=x; SRD's Obsolete Versions output). But that doesn't exist out of the box, so you can not "assume" it will be there.
------------------
Hein,
I thought a unix i-node was analogous to a VMS file header, and that a unix directory was a special file that contained names and i-node numbers, very similar in concept to a VMS directory. VMS directories are more constrained because they are stored in sorted order and must be contiguous, and has things the unix directory does not, e.g. the version limit for a filename.
While it is true that getting anything but the filename will result in having to get the information from the file header, the same is true for unix (although the unix buffer cache may make a trip to the disk less likely). For whatever reason, VMS engineering didn't think sorting by anything other than name was important, and I my opinion, that was a mistake.
Think about it, if we do a directory/size or directory/own, or directory/date we must already fetch the file header, so why not allow the directory to be sorted.
In RSX, the directories were not stored in alphabetical order, thus SRD (sorted directory) was quickly written, and it could sort by more than just the file name, it could sort by dates as well. (See QSDB as a VMS utility with similar sorting functionality).
Even MS-DOS can sort directories.
> dir /o:d (or /o:-d for newest files first)
will sort in date order.
That VMS has never enhanced directory to provide at least what the RSX SRD utility did, and never provided auto synchronization of VMS$MAIL_PROFILE's unread mail counter with mail.mai is an embarrassment. How many times have you had to answer "MAIL says I have 3 new messages, but there aren't any"? Expecting users to read the VMS FAQ is not the answer.
Claiming that either of those was never done because it was too inefficient is an excuse that has been obsolete for the last 15 years. Seriously, to fix the mail problem for the most noticeable case, where VMS tells you have unread mail when in fact you do not, would only require a keyed read of mail.mai to see if there is a least one record in the NEWMAIL folder (for interactive processes anyway). Most people don't care (and would never notice) if they are told they have 48 new messages when in fact they only have 45, but they will notice when they are told they have new mail, but when they enter mail, they do not.
Sorry for the tangent... zero points.
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 10:29 AM
тАО01-07-2008 10:29 AM
Re: How to find latest created file in VMS ?
see attached file, sort_by_date.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2008 11:05 AM
тАО01-07-2008 11:05 AM
Re: How to find latest created file in VMS ?
$ file = F$SEARCH("[...]*.tmp;*")
to
$ file = F$SEARCH("[...]*.*;*")
should do exactly what was asked for.
However, VMS Directory should have the ability to sort by many things, including the file dates. Even sorting by owner or protection could be useful. And sorting the output of directory is not the correct solution, there are just too many things that must be considered, the most obvious is the problem of long file names causing wrapping. Yes, there are ways to avoid most of the problems, but why shouldn't VMS directory be able to do this straight out of the box?
P.S. in my last response, I used the incorrect name for a unix file header. It is inode, not i-node. The unix analogue of a VMS FID is the unix inode number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 08:02 PM
тАО01-08-2008 08:02 PM
Re: How to find latest created file in VMS ?
About how many files per day are being created in that directory?
If you don't want to do a command file, you can get a list of recent files like this:
$ dir/since/size/date
This would be all files from today
$ dir/since=12:00/size/date
That would be all of the files since noon. Or you could put any time in the /since= qualifier.
$ dir/since=19:44/size/date
Or whatever time you want.
So if this narrows down the number of files you can see on, say, one screen, you can easily see which files were created last.
Also, $ dir/date=all or dir/modified will tell you when the file was modified if it was not necessarily created today.
You might want to check out
$ help directory
for all of the command qualifiers available to DIR.