Q:

Compare 2 Dictionaries with Inner List into a Diff Dictionary?

Currently I have 3 Dictionaries:
private Dictionary<string, List<string>> oldList = new Dictionary<string, List<string>>();
private Dictionary<string, List<string>> newList = new Dictionary<string, List<string>>();
private Dictionary<string, List<string>> patchList = new Dictionary<string, List<string>>();

The oldList and newList are filled with a directory and all it is subdirectories and files where the root and subdirectories are the key and the files are the inner list of all files in the directory.
Code that is used to fill the newList:
    private void ProcessDirectory(string targetFolder)
    {
        List<string> newInnerList = new List<string>();
        newList.Add(targetFolder, newInnerList);
        newInnerList = newList[targetFolder];

        foreach (string file in Directory.GetFiles(targetFolder))
            newInnerList.Add(Path.GetFileName(file));

        foreach (string dir in Directory.GetDirectories(targetFolder))
            ProcessDirectory(dir);
    }

Is it ok to use a
Dictionary with a inner List to hold
this data or is there a better way to
do this ?

Now I want to compare the newList against the oldList and find what files have changed and what files the new list has that the old list does not.

What would be the best way to iterate
between the 2 lists while doing a
checksum on the files to fill the
patchList ?

A:

Iterate over folders and call a function passing two paths and yielding the differences (files in A which is not in B and files in B which is not in A and files that changed) in three separate sequences.
Another Solution if you like:
var sourceFiles = Directory.GetFiles(source, "*", SearchOption.AllDirectories).Select(o => o.Replace(source, ""));
var targetFiles = Directory.GetFiles(target, "*", SearchOption.AllDirectories).Select(o => o.Replace(target, ""));

var sourceFilesNotInTarget = sourceFiles.Except(targetFiles);
var targetFilesNotInSource = targetFiles.Except(sourceFiles);

var changedFiles = sourceFiles.Join(targetFiles, a => CheckSum(a, source), b => CheckSum(b, target), (a, b) => a);

Related Question that may be helpful 

