troubleshooting Question

How would i do a complete folder compare and copy difference in autoit

Avatar of bbimis
bbimis asked on
ProgrammingScripting LanguagesVB Script
7 Comments2 Solutions1639 ViewsLast Modified:
I have a folder out on a networkshare lets call it c
i want to copy all of its contents over to a computer i'm settings up and ONLY copy files to the computer that are not there or different on the networkshare.

so lets say i have c:\backup.bat  on the networkshare
i want it to be the exact same on the new computer.

the exact same structure and and subdirectory structure should apply

i have something like this already in vb but it doesn't check for existance or differences.

'Copy Folder Structure
        bkwrk.ReportProgress(0, "0|0|Getting Folder Structure (mis/" & sMachine & ")...")
        iMaxCnt = My.Computer.FileSystem.GetDirectories("\\mis\mis3\machines\" & sMachine & "\c\", FileIO.SearchOption.SearchAllSubDirectories, "*.*").Count
        For Each strFolders In My.Computer.FileSystem.GetDirectories("\\mis\mis3\machines\" & sMachine & "\c\", FileIO.SearchOption.SearchAllSubDirectories, "*.*")
            iCurCnt = iCurCnt + 1
            sDestination = "C:\" & Mid(strFolders, InStr(strFolders, "\C\") + 3, strFolders.Length - InStr(strFolders, "\C\"))
            bkwrk.ReportProgress(iCurCnt / iMaxCnt * 100, iCurCnt & "|" & iMaxCnt & "|Creating Folder: " & sDestination) 'Strings.Left(strFolders, 10) & "..." & Strings.Right(strFolders, 15))
            My.Computer.FileSystem.CopyDirectory(strFolders, sDestination, True)
        'Copy Program Files
        bkwrk.ReportProgress(0, "0|0|Getting Files (mis/" & sMachine & ")...")
        iCurCnt = 0
        iMaxCnt = My.Computer.FileSystem.GetFiles("\\mis\mis3\machines\" & sMachine & "\c\", FileIO.SearchOption.SearchAllSubDirectories, "*.*").Count
        For Each StrFiles In My.Computer.FileSystem.GetFiles("\\mis\mis3\twmachines\" & sMachine & "\c\", FileIO.SearchOption.SearchAllSubDirectories, "*.*")
            iCurCnt = iCurCnt + 1
            sDestination = "C:\" & Mid(StrFiles, InStr(StrFiles, "\C\") + 3, StrFiles.Length - InStr(StrFiles, "\C\"))
            bkwrk.ReportProgress(iCurCnt / iMaxCnt * 100, iCurCnt & "|" & iMaxCnt & "|Copying File: " & sDestination) 'Strings.Left(StrFiles, 10) & "..." & Strings.Right(StrFiles, 15))
            My.Computer.FileSystem.CopyFile(StrFiles, sDestination, True)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros