jQuery in Action, 3rd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes comparing two directories Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "comparing two directories" Watch "comparing two directories" New topic
Author

comparing two directories

seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
Hi, I would like to find a task that does this:

Has two properties, compare-directory and to-directory. Compares the two directories recursively and outputs the difference to a file.
The output of the compare operation should depend on boolean parameters, such as: "show files that are only in the compare location", "show files that are only in the to location", "show files that are different in both locations".

Example:
I want to use this to compare an older fileset (directory B) of a project with a newer subset of files (directory A) that is to be merged with the older.
I want to find out about all files that exists in directory A and not in directory B. I do not want info about files that exists in directory B and not in directory A. Lastly I want info about files that exists in both places but differ.

Does such a task exist? If not, are there tasks that would facilitate creating a task that does this for me?

Thanks.

Seb
[ August 02, 2006: Message edited by: seb petterson ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17039
    
  26

The Linux version of the "diff" utility does something like this.


An IDE is no substitute for an Intelligent Developer.
seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
Originally posted by Tim Holloway:
The Linux version of the "diff" utility does something like this.


Thanks, but I am looking to have this as an ANT task so I can incorporate it in an existing script. The only common denominator that I can assume between me and the other people using the script is that they can run ANT with custom tasks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comparing two directories
 
It's not a secret anymore!