Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Pls help...new to scripting

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Pls help...new to scripting
  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 >>
 Pls help...new to scripting - 1/16/2007 6:47:25 AM   
  bnath001

 

Posts: 1
Score: 0
Joined: 1/16/2007
Status: offline
I am writing vbscript code that checks for existence of file in a folder and if the file exists, should actually compare the file creation date with the system date.
if they are equal, it should rename the file to .old extention.

I have hard time to compare two dates. How to compare two dates (short format).

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\code\OpicsEod\check.vbs")
If objFile.Size > 0 Then
  
   if date = cdate(objFile.DateCreated) Then
       wscript.Echo "same date"
   else
       wscript.Echo "not same date"
   end if
Else
   Wscript.Echo "The file is empty."
End If

help much appreciated.
thanks
nath
 
 
Post #: 1
 
 RE: Pls help...new to scripting - 1/16/2007 7:06:38 AM   
  dm_4ever


Posts: 2721
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
I saw this same question here: http://www.tek-tips.com/viewthread.cfm?qid=1321677&page=1

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to bnath001)
 
 
Post #: 2
 
 RE: Pls help...new to scripting - 1/16/2007 7:43:59 AM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Here is some code from a larger script that uses a function written by a former coworker to compare file versions.


      

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to dm_4ever)
 
 
Post #: 3
 
 
 
  

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 >> Pls help...new to scripting 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