I have a simple requirement to compare the files in two directory structures. Per file name in the first directory structure, see if the same file exists in the same relative location in the second directory structure and if it does compare both file contents and if one is a duplicate of the other delete the second one. i.e. Directory 'one' contains files x.java, y.java, z.java Directory 'two' contains files x.java, z.java Compare one/x.java to two/x.java - if identical delete two/x.java two/y.java doesn't exist - go on to the next file. Compare one/z.java to two/z.java - if identical delete two/z.java I figured a find command could do this and wrote the following simple script "dircomp" that takes the two directory names as passed in parameters. Note that one find command differs with the next only by an echo so I can see what's going on because I can't get it to work. It doesn't try removing any duplicate files yet since I can't get the thing to work. #!/bin/bash cd "$1" find . -name '*.java' -type f -exec echo test -e ../"$2"/{} '&&' diff {} ../"$2"/{} ';' find . -name '*.java' -type f -exec test -e ../"$2"/{} '&&' diff {} ../"$2"/{} ';' Sitting where the one and two directories are immediately below, dircomp one two produces the following: test -e ../two/./x.java && diff ./x.java ../two/./x.java test -e ../two/./y.java && diff ./y.java ../two/./y.java test -e ../two/./z.java && diff ./z.java ../two/./z.java test: too many arguments test: too many arguments test: too many arguments The echo'd statements look OK to me, so why the test errors? When I manually: cd one test -e ../two/./x.java && diff ./x.java ../two/./x.java it works. Why won't it work from the scripted find? Bill Gradwohl (817) 224-9400 x211 www.ycc.com SPAMstomper Protected Email -- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list