[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] check datetime stamp on file



Thanks, George.  Just the ticket!


George Jansen <GJANSEN@aflcio.org> wrote:on Unix, 

find /whiz -name bang -mtime -1

will return a 0 if /whiz/bang exists and has been modified in the last
24 hours, non-zero otherwise.

On NT I suppose you could use a fragment of VBScript that would raise
an error if the file did not exist.


>>> JHarris@frederick.edu 08/30/04 12:33PM >>>

To see if the file exists, simply try to open it for reading - if it
does not exist you will get an error code.

open $filename as 6 for-reading record=132:vary status=#filestat

In this case, the #filestat variable would end up with 0 or -1
depending on the success. 0 means the file is there and readable, -1
means something prevents you from opening it for reading (file
permissions and even file locking could also cause such a failure). 

Getting the date/time isn't as easy. 

One way would be to call system and perform a directory listing of the
file you want to check, and parse it. Of course that's very messy
and
platform specific. 

-----------------------------------------------------
James Harris
Junior Systems Programmer/Analyst
Information Technology Division
Frederick Community College
-----------------------------------------------------

>>> lakef250@yahoo.com 8/30/2004 11:05:17 AM >>>
RESEND:
Anyone know how to determine datetime of a file programmatically? 


Yuri Lakef wrote:Greetings to all,

I'd like to add a procedure in my SQR to call the operating system and
check if a file exists or not (SQR reads a file and loads a table). If
it does exist, I'd like to check the datetime stamp for the file and
only process if it matches "today's date." 

Are there operating system (or better yet, SQR) functions/features
that
allow this? We're on Unix AIX and NT.

Much thanks!




---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org 
http://www.sqrug.org/mailman/listinfo/sqr-users 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org 
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users


                
---------------------------------
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users