1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Directory contents compare

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

  1. 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

     Dim fs, objFolder, objFiles, objFile
    Dim strMasterFilePath, objMasterFile, strTargetFilePath
    Dim sf, objFolder, objFiles, objFile
        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
            End If
            strTargetFilePath = objFile
            Set objMasterFile = Nothing
        Set colFiles = Nothing
        Set objFile = Nothing
        set objFolder = Nothing
        Set fs = Nothing
        Set fs = Nothing
  2. I Have figured it out

Share This Page