views:

38

answers:

1

I have two copies of an application source code. One copy is encoded, while the other is not. There are config files scattered through-out the application's directory structure, and this is what I would like to compare.

Is there a way to use diff where-by I can ignore the wildly different files (ie: An encrypted file and an unencrypted file), and only report the difference on the similar-yet-different files (The configs).

+1  A: 

You could write a script that uses find to find the files based on name or other criteria and file to determine whether they have the same type of contents (i.e. one compressed, one not).

For me to be more specific I would need you to give more details about whether these are parallel directory structures (files and directories appear in the same places in the two trees) and whether the files you are looking for have names that distinguish them from files you want to ignore. Any additional information you can provide might help even more.

Dennis Williamson
Thanks for your help Dennis. The file names are identical. There's a chance of some files or directories missing from either copy. The application is written in PHP, and the encoded copy has been encoded with ionCube PHP Encoder. So the file names match. I hope that helps.
abrereton
How are the config files named? Are their names distinct from other filenames in the trees? Are there files other than these that you want to compare? The more specific you get, the simpler a script would be. If you want to compare all corresponding `*.conf` files, but no `*.php` files and no files without a dot, for example.
Dennis Williamson
The config files do not have a common name such as *.conf, *.cfg, conn_*, or anything like that. Some are .conf, most are .php. They have various file names and are scattered throughout the directory structure. I wish they did have a common file name!
abrereton
You still haven't answered whether the files appear in the same places in the two trees. I think you should just use my general suggestion and experiment on your own.
Dennis Williamson
Yes the files appear in the same places in the two trees.
abrereton