Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


File timestamp check in VBScript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,25549
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> File timestamp check in VBScript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 File timestamp check in VBScript - 9/5/2005 4:37:13 AM   
  reloader

 

Posts: 72
Score: 0
Joined: 9/5/2005
Status: offline
Hi everybody,

I would like to ask somebody about timestamp.
I'm writting a script, but I don't now, that how can I store a file timestamp in a variable(s). Can anybody help me?

Thanks In Advance.
 
 
Post #: 1
 
 RE: File timestamp check in VBScript - 9/5/2005 5:37:56 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Hello and welcome Reloader.... this is a very general question... You may find practical answers on our forum or for official MS descriptions, please see:

Date Function | Day Function | Hour Function | Minute Function | Month Function | Second Function | Time Function | Weekday Function | Year Function

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to reloader)
 
 
Post #: 2
 
 RE: File timestamp check in VBScript - 9/5/2005 7:12:49 AM   
  reloader

 

Posts: 72
Score: 0
Joined: 9/5/2005
Status: offline
Hello,

Thanks for the help, but on the official MS page, there is no any concrete help for tihs problem, or I'm blind:)

I try to explain exactly my problem. The first is that I'm new in VBScript:)
The second, that I need to write a script for a batch. The batch is move many files in a folder once a day. My script has to view the timestamp of these files, and delete those, what are older than one month.

Your suggest is good for the comparison, but for the timestamp checking.
If your next answer will be the same, I swear I'm going to optometrist:)

PS.: Sorry for my English.

(in reply to reloader)
 
 
Post #: 3
 
 RE: File timestamp check in VBScript - 9/5/2005 7:30:33 AM   
  Snipah


Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Hiya,

this may be of some help: (not tested by me personally)

Option Explicit
Dim FSO,File
Dim Date1,Date2,Hour1,Hour2
set FSO=CreateObject("Scripting.FileSystemObject")
Set File=FSO.GetFile("i:\x.txt")
Date1=Now()
Date2=File.DateLastModified
wscript.echo Date1
wscript.echo Date2
Hour1=DatePart("h",Date1)
Hour2=DatePart("h",Date2)
wscript.echo Hour1-Hour2,"Hours"
wscript.echo DateDiff("h",Date2,Date1),"Hours"
wscript.echo DateDiff("n",Date2,Date1),"Minutes"
wscript.echo DateDiff("s",Date2,Date1),"Seconds"

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to reloader)
 
 
Post #: 4
 
 RE: File timestamp check in VBScript - 9/5/2005 7:42:59 AM   
  reloader

 

Posts: 72
Score: 0
Joined: 9/5/2005
Status: offline
Thank you!

I will test it. I know, this is not a real programming, that I ask for codes, but it's important now:(

Thx again, and best regards,

Attila

(in reply to reloader)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> File timestamp check in VBScript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts