Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Directory contents compare (http://www.go4expert.com/forums/directory-contents-compare-t22664/)

jamie-lill@live.ca 9Jul2010 00:49

Directory contents compare
 
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 Code:

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:

jamie-lill@live.ca 9Jul2010 23:26

Re: Directory contents compare
 
I Have figured it out


All times are GMT +5.5. The time now is 07:01.