Copying a Folder from the Server to the Local My Documents folder.

Discussion in 'Scripting' started by Jason Thomas, Jul 31, 2006.

  1. Jason Thomas

    Jason Thomas Guest

    I have been looking to copy a folder containing a series of folders and other
    documents from a network location to the user's My Documents folder within
    their local user profile. My users spend large amounts of time disconnected
    from the network or are in locations without network connectivity. As a
    result, they need to have this information locally.

    I came across the following script today that seemed to fit the bill, but I
    also wanted to include some intelligence in the script to see if the folder
    existed. Thus, I want the script to see if the folder exists. If it does,
    then the script can exit with a cheery message stating that Folder Foo exists
    already. If the script sees that the folder does not exist, I want it to
    copy over the folder from the network location.

    The script I found that is a great starting point to perform the file copy
    is here
    Of course, my testing has turned up some syntax errors per my edits, so I
    need to examine this a bit further. Here is my script, as it stands in its
    error filled glory.

    'Const OverwriteExisting = TRUE
    Const USER_PROFILE = &H28&

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(USER_PROFILE)
    Set objFolderItem = objFolder.Self
    strTemplatePath = objFolderItem.Path & "\My Documents\"

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile "\\sbacs0001\Share\Engagement Administration\" ,
    strTemplatePath ', OverwriteExisting

    So, the question I have is what am I doing wrong? Is there a better way to
    do this than the method I am proposing?

    Thanks from a scripting n00b,
    Jason Thomas, Jul 31, 2006
    1. Advertisements

  2. Jason Thomas

    Babu VT Guest

    Hi Jason,

    I'm afraid if you dont copy existing folders then your users will be
    having old versions of it locally and any new additions to already
    existing folder in network will not be copied.

    I would suggest you to use Windows Synchronisation between local PC
    folders and network location using any one of below methods,

    1. ***Freeware*** 3rd Party Synch tools

    2. Robocopy

    3. Default Windows Synchronisation

    Jason Thomas wrote :
    Babu VT, Aug 1, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.