1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Conditional copy

Discussion in 'Windows Server System' started by Jared, 2009/11/16.

  1. 2009/11/16
    Jared

    Jared Inactive Thread Starter

    Joined:
    2009/07/14
    Messages:
    5
    Likes Received:
    0
    I don't know if this is the right place for this, but...

    A client of ours is upgrading to Office 2007 and in the process they are having a number of custom macros and templates created. These macros/templates will be changing from time to time (especially while they are new) so we want to make sure everyone has the latest copy of them on their local workstations.

    The reason we do not want to have them access the files from the network is that if changes need to be made, people will then have to close word so that the old file can be removed and the new one can be inserted into the templates directory. Also with 60 people using the same templates we want to make sure that there are no access problems/accidental changes made.

    I am wondering if somebody can push me in the right direction as far as what would be the best way of doing this. So far I am looking at adding lines to the login.bat script that runs when users login, however I am not too familiar with how to make it check the file versions, and there are about 40 templates so I really don't want to add a line for each one.

    If there is anyone who would be willing to help me with the script, or who can suggest a better way of doing this, it would be greatly appreciated.

    Thank you in advance.
     
  2. 2009/11/17
    amdace

    amdace Inactive

    Joined:
    2009/09/08
    Messages:
    70
    Likes Received:
    3
    You could do version checking at login via wsh scripting but like you noticed, you would have to check each file individually.
    From an admin standpoint, I would use a network share for templates and only update the templates outside of business hours. To guard against rogue changes, just set share perms to read only for all users.
    Here is an example script I found that will check version or size and update the file based on the result.

    Set objFileSystem = CreateObject( "Scripting.FileSystemObject ")

    strSource = "\\Server\Share\File.exe "
    strDestination = "C:\Things\TheProgram\File.exe "

    ' Update based on Version

    strSrcVersion = objFileSystem.GetFileVersion(strSource)
    If objFileSystem.FileExists(strDestination) Then
    strDstVersion = objFileSystem.GetFileVersion(strDestination)
    Else
    strDstVersion = " "
    End If

    If strSrcVersion <> strDstVersion Then
    objFileSystem.CopyFile strSource, strDestination, True
    End If


    ' Update based on Size

    Set objSrcFile = objFileSystem.GetFile(strSource)
    strSrcSize = objSrcFile.Size
    If objFileSystem.FileExists(strDestination) Then
    Set objDstFile = objFileSystem.GetFile(strDestination)
    strDstSize = objDstFile.Size
    Else
    strDstSize = " "
    End If

    If strSrcSize <> strDstSize Then
    objFileSystem.CopyFile strSource, strDestination, True
    End If
     

  3. to hide this advert.

  4. 2009/11/25
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Have you looked at robocopy which has a switch to only copy files that have changed since the last run or can be used to mirror two locations?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.