Directory contents compare

Discussion in 'Visual Basic ( VB )' started by jamie-lill@live.ca, Jul 8, 2010.

  1. jamie-lill@live.ca

    jamie-lill@live.ca Banned

    Joined:
    Jul 8, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    As I am new to scripting, I have tried to piece together a script file which checks
    to see if the files on the server are newer and also if new files exist in the server directory.
    They will be checked against my local directory.
    If there are newer files dates and or new files in the server directory, I wish to copy the directory to my local drive.
    Please Help

    Thanks
    HTML:
     Dim fs, objFolder, objFiles, objFile
    Dim strMasterFilePath, objMasterFile, strTargetFilePath
    Dim sf, objFolder, objFiles, objFile
    
    
    
    'Update CATALOGES DIR
        Set sf= CreateObject("Scripting.FileSystemObject")
        Set fs= CreateObject("Scripting.FileSystemObject")
        Set objFolder = fs.GetFolder("C:\Pricer\cataloges")
        Set colFiles = objFolder.Files
    
        For Each objFile in colFiles
            strMasterFilePath = "G:cataloges\" & objFile.Name
            Set objMasterFile = fs.GetFile(strMasterFilePath)
            
            If objMasterFile.DateLastModified>objFile.DateLastModified Then
                    objMasterFile.Copy(objFile)
            End If
            
            strTargetFilePath = objFile
            Set objMasterFile = Nothing
        Next
        
        Set colFiles = Nothing
        Set objFile = Nothing
        set objFolder = Nothing
        Set fs = Nothing
        Set fs = Nothing
    
     
    :crazy:
     
  2. jamie-lill@live.ca

    jamie-lill@live.ca Banned

    Joined:
    Jul 8, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I Have figured it out
     

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.
    Dismiss Notice