Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loginscript - copy file only if newer

Status
Not open for further replies.

macroy73

Technical User
Joined
Mar 31, 2005
Messages
2
Location
SE
Have tried to get a loginscript to copy only if orginal file is updater/newer that for the client.

Today we always copy this and some other files
-----
fso.CopyFile "\\fpsserver4\ToolsOst\outcopy\3\PENGRAP32.MDB", "U:\3\Pengrap32.mdb", true
-----
Is there any way to add attribs to the script or how to fix this question.
 
bind to both files using:

Set objFileSource = FSO.GetFile("\\fileA")
Set objFileDest = FSO.GetFile("\\fileB")
compare the datelastmodified? presume you arent going to run into time difference issues? might need to use some sort of jscript wsf file include for this?
If objFileSource.DateLastModified > objFileDest.DateLastModified Then
fso.CopyFile
End If

i would advise you check for the existance of both the source and target first
then you can copy to the target if the target doesnt exist...and you wont get run times.
I would seriously advise you to create a log file for your entire logonscript, have it log to central location named accorfing to username / machine name. have it time stamp each entry, have it log at every chance it gets (you might want to write to a temp local location then copy it up afterwards)
 
You could also use ROBOCOPY with the /XO switch.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
this rows fixed it for me thx a lot for the quick help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top