Windows Scripting - Timestamp, files, need help. :)
- From: "Samantha" <mindfulsilence@xxxxxxxxx>
- Date: 8 Jan 2007 13:14:33 -0800
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
.
- Follow-Ups:
- Re: Windows Scripting - Timestamp, files, need help. :)
- From: Gino
- Re: Windows Scripting - Timestamp, files, need help. :)
- From: Ayush
- Re: Windows Scripting - Timestamp, files, need help. :)
- From: joseomjr@xxxxxxxxx
- Re: Windows Scripting - Timestamp, files, need help. :)
- Prev by Date: Create A Vbs Whit Command Set Logon
- Next by Date: Re: Windows Scripting - Timestamp, files, need help. :)
- Previous by thread: Create A Vbs Whit Command Set Logon
- Next by thread: Re: Windows Scripting - Timestamp, files, need help. :)
- Index(es):
Relevant Pages
|