Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Pop up message if a file is older than...

Reply
 
Old 01-16-2009   #1 (permalink)
Jake


 
 

Pop up message if a file is older than...

Hi,

In a vbs logon script I need to pop up a small message if a certain file
is older than a certain date or a certain size. How do I do that in vbs...?

Thanks for tips on this

regards

jake

My System SpecsSystem Spec
Old 01-16-2009   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Pop up message if a file is older than...


"Jake" <jake44@xxxxxx> wrote in message
news:OHCYDo6dJHA.3520@xxxxxx
Quote:

> Hi,
>
> In a vbs logon script I need to pop up a small message if a certain file
> is older than a certain date or a certain size. How do I do that in
> vbs...?
>
> Thanks for tips on this
>
> regards
>
> jake
It depends on your requirements. If you want the file to be checked once
every few hours then you could use the Task Scheduler to invoke a small VB
Script to check the file size. If you want the file to be checked
permanently, e.g. every 10 seconds, then a WMI solution would be more
appropriate. This will, of course, load up your CPU.


My System SpecsSystem Spec
Old 01-16-2009   #3 (permalink)
Jennifer


 
 

Re: Pop up message if a file is older than...

On Jan 16, 1:14*am, Jake <jak...@xxxxxx> wrote:
Quote:

> Hi,
>
> In a vbs logon script I need to pop up a small message if a certain file
> is older than a certain date or a certain size. *How do I do that in vbs...?
>
> Thanks for tips on this
>
> regards
>
> jake
Dim fso
Dim fil

Dim sFileName
Dim iFileSize
Dim iFileModDate

sFileName = "C:\Test\Test.txt"
iFileSize = 1 'in bytes
iFileModDate = #1/1/2000#

Set fso = CreateObject("scripting.filesystemobject")
Set fil = fso.GetFile(sFileName)


If fil.Size> iFileSize Or fil.DateLastModified> iFileModDate Then
MsgBox "File Name: " & fil.Name & vbCrLf & _
"File Size in Bytes: " & fil.Size & vbCrLf & _
"Date Last Modified: " & fil.DateLastModified
End If
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
file delete message General Discussion
accidently replace file with older version Vista file management
coping file from a remote file share - FILE IS NO LONG THERE bogus error message Vista networking & sharing
Can't find the file specified message Vista General
File burn message Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46