Jump to content

Need To Compare Folders


Recommended Posts

I'm wanting to make find a script that can do the following:

I want to examine two different folders and see a list of all the files & folders (and their paths) that exist in one folder but not the other.

Does anything like this already exist?

Thanks

~Flint Brenick~

Link to comment
Share on other sites

  • Moderators

Moved to the support forum. The example forum is not for questions.

Your question doesn't make much sense... what is "not the other"?

Look at _FileListToArrayEx or _FileListToArrayNew in the search directory of the forum.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm thinking he wants something like:

#Include <File.au3>
#Include <Array.au3>
$folder1 = "D:\Folder 1"
$folder2 = "D:\Folder 2"
$folders = _FindFolderFileDifferences ($folder1, $folder2)
_ArrayDisplay ($folders)

Func _FindFolderFileDifferences ($folder1, $folder2, $filters = "*", $options = 0)
    Local $temparray[1]
    Local $count = 1
    Local $_Folder1 = _FileListToArray ($folder1, $filters, $options)
    Local $_Folder2 = _FileListToArray ($folder2, $filters, $options)
    
    For $i = 1 to $_folder1[0]
        If _ArraySearch ($_folder2, $_folder1[$i]) = -1 Then
            ReDim $temparray[$count+1]
            $temparray[$count] = $_folder1[$i]
            $count += 1
        EndIf
    Next
    
    $temparray[0] = $count - 1
    Return $temparray
EndFunc

It finds files in Folder 1 that do not exist in Folder 2.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...