Diff is normally used to compare two files, but can do much more than that. In diff he options "r" and "q" make it work recursively and quietly, that is, only mentioning differences, which is just what we are looking for:
diff -rq todo_orig/ todo_backup/
If you also want to see differences for files that may not exist in either directory:
On Windows, I believe windiff does it, however Winmerge is my tool of choice for this job. It's open source and does a very neat job of comparing two sets of directory trees.
I wrote this using the Compare-Objects cmdlet in Powershell:
#set the directories
$firstdirectory = Read-Host "What is the first directory you wish to compare?" $seconddirectory = Read-Host "What is the second directory you wish to compare?"
#Check if the user wants to compare subdirectories
$recursivesearch = Read-Host "Do you wish to compare subdirectories? Please enter yes or no." If ($recursivesearch -eq "yes")
#get the contents
{ $firstdirectorycontents = @(Get-ChildItem $firstdirectory -Recurse) $seconddirectorycontents = @(Get-ChildItem $seconddirectory -Recurse ) }
else { $firstdirectorycontents = @(Get-ChildItem $firstdirectory) $seconddirectorycontents = @(Get-ChildItem $seconddirectory) }
#compare the objects and handle errors
if ($firstdirectorycontents.Count -eq 0 )
{
Write-Host "No files were found in the first directory, the directories cannot be compared."
}
elseif ($seconddirectorycontents.Count -eq 0)
{
Write-Host "No files were found in the second directory, the directories cannot be compared."
}
else
{
try
{
Compare-Object -ReferenceObject $firstdirectorycontents -DifferenceObject $seconddirectorycontents
}
catch {"Another error occured."} }
Under Linux:
Under Windows: you'd probably better download and install WinMerge, then
M
I used meld on Ubuntu - it has a good directory comparison option.
Diff is normally used to compare two files, but can do much more than that. In
diff
he options "r" and "q" make it work recursively and quietly, that is, only mentioning differences, which is just what we are looking for:If you also want to see differences for files that may not exist in either directory:
You can also use
Rsync
andfind
. Forfind
:But files with the same names and in the same subfolders, but with different content, will not be shown in the lists.
If you are a fan of GUI, you may check Meld. It works fine in both windows and linux.
Beyond Compare is a good commercial tool, $30 or so. Runs under windows, has an eval version. http://www.scootersoftware.com/
On Windows, I believe windiff does it, however Winmerge is my tool of choice for this job. It's open source and does a very neat job of comparing two sets of directory trees.
edit: oops, was beaten to it by Marius
DiffMerge for Windows shows differences including subfolders in a window. There is also a portable version somewhere but a quick search revealed this download: http://www.softpedia.com/get/System/File-Management/SourceGear-DiffMerge.shtml
I wrote this using the Compare-Objects cmdlet in Powershell: