Windows Scripting - Timestamp, files, need help. :)



Hi there...

So, I've been Googling for days. I'm relatively new to programming
concepts - although I played with BASIC at the age of 8, and am
starting to tinker with Ruby, I have a task ahead of me with work that
I am losing my mind on. :)

In any case, I need to write a script in vbscript (I want to use
Windows Script Host) that does the following:

Goes into specified directory - let's call it E:\Data
Checks to see if there are any files.
If there are files present, checks to see what the timestamps are.
(likelihood is that there will be more than 1 file present if there are
any files at all.)
Gets the Highest (most recent timestamp) and compares it to the current
time.
If the most recent timestamp on the file is more than two hours old,
the script/program will send an email to a specified email address,
alerting that there are files present that are more than 2 hours old.

Sounds simple in theory, and probably is, but I can't get my head
wrapped around it.

I'm not too familiar with the syntax of vbscript, but I had a few
thoughts that I experimented with in Ruby...

Basically getting the current time, and formatting it YYYYMMDDHHMM
converting that to an integer...
getting all the timestamps from the files in the directory and putting
them into an array...
formatting each item in the array into the format YYYYMMDDHHMM
getting the Max (most recent timestamp) from the array...
and then, if currentTime - 200 > mostRecentTimeStamp having it trigger
off the email...

I hope I've been able to articulate myself properly. I am not asking
for anyone to write a script for me, but I'd love some guidance... I
have the 'logic' worked out in my head and on paper to a certain
extent... I could probably have someone write this for me at work, but
I wouldn't be learning anything then... :)

Thanks so much.

-S

.



Relevant Pages

  • Re: Entering a TimeStamp value into DB2
    ... I went to google and searched for "db2 timestamp" and this ... If formatting the date and time data is a major consideration for your ... These facilities are not available for TIMESTAMP columns. ... correctly format the 'TimeStamp' value in my script so that the ...
    (perl.dbi.users)
  • Re: Maintaining data integrity with multiple users
    ... The way I work this problem is by using a timestamp field in the DB showing ... The first field is a record lock timestamp and the ... point the script will verify the record lock timestamp. ... to see if it is stale by comparing it to the current system time. ...
    (comp.lang.php)
  • Re: How to resolve timestamp?
    ... What I want to achieve is to resolve a timestamp from its pathetic format (I ... This is why I am interested in some kind of script or algorithm which can ... mind you have to add the Leap Days in Leap Years. ...
    (microsoft.public.windows.server.dns)
  • Re: Unix file timestamp issue ..
    ... the latest timestamp on everyrun. ... There is some unknown process which is acting on this and changing the ... ls -lc filename should show when the timestamp was changed. ... file by creating a customized shell script through which you may use ...
    (comp.unix.shell)
  • Re: How to easily append a timestamp to tar archive name ?
    ... However I would like to automatically append a timestamp whenever I call this command ... Does Gnu-tar offer such an automatic timestamp appending? ... It *should* also work when called from a perl script, ...
    (comp.lang.perl.misc)