Link to home
Start Free TrialLog in
Avatar of iramirezs
iramirezs

asked on

comparing two files

i need know with code .vbs how to compare two files  

file1 is on c:\datos\online.mde
file2 is on   \\server2k\update\online.mde

if the date created of the file2 is > file1
     copy the file2 on file1

sorry my english is very bad.

Thks
ASKER CERTIFIED SOLUTION
Avatar of twalgrave
twalgrave

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of twalgrave
twalgrave

You must add a reference to the Microsfot Scripting Runtime for this to work
Scripting is all new to me. It looks really interesting.

Just wondering, couldn't you use built-in functions in VB to do this? Like:

 
If FileDateTime(file2) > FileDateTime(file1) then
   FileCopy file2, file1
endif

?    
I suppose you could, but I'm not sure if it will take UNCs as indicated in the question.  I'm not sure it won't, but since I'm fairly certain I have used the FSO with UNCs..  I'm going to try the FileDateTime on a UNC when I get into work.  Will let you know.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- Assign the points to twalgrave
Please leave any comments here within the
next seven days.
Per recommendation, force-accepted.

Netminder
EE Admin