Solved

VB script to check the modified date on a specific file, and return a value

Posted on 2009-07-01
3
584 Views
Last Modified: 2013-12-26
Hi all,

I'm using Solarwinds IP Monitor to ensure that a certain file is being copied each day onto a server. Unfortunately IP Monitor does not allow for this functionality out of the box, but it does allow you to run scripts that return an expected value, and set off an alert if this value is not returned.

SO..... I need a vb script to check the modified date on a specific file. if the modifeid date is a week older than the curren systemt date, return a value of 1. otherwise return 0

Can I get a hand from any scrpiting gurus?
0
Comment
Question by:nlc_IT_Dept
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
kevin_u earned 500 total points
ID: 24760405
I believe this is what you wanted.

set fso = WScript.CreateObject("Scripting.FileSystemObject")
 
set f = fso.GetFile("somefile.txt")
 
if (Now - f.DateLastModified) > 7 then
	WScript.Quit 1
end if
 
WScript.Quit 0

Open in new window

0
 

Author Comment

by:nlc_IT_Dept
ID: 24760471
That looks very promising! Am I able to put a UNC path into the "set f = fso.GetFile("somefile.txt")" line or does it have to be a local path?
0
 

Author Comment

by:nlc_IT_Dept
ID: 24760506
Nevermind, working perfectly! Thanks kindly!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question