You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/01/16 23:44:07 UTC

DO NOT REPLY [Bug 12632] - [PATCH] New to synchronize a local directory from one or more s

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12632>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12632

[PATCH] New <lsync> to synchronize a local directory from one or more <fileset>s





------- Additional Comments From daniel.armbrust@mayo.edu  2003-01-16 22:44 -------
I tried this out, and it worked nearly perfect for me.

The one thing that it doesn't do it remove orphaned directories.

I changed the removeOrphanedFilesMethod to the following:

	private int removeOrphanFiles(Hashtable nonOrphans, File file) {
		int removedCount = 0;
		if (file.isDirectory()) {
			File[] children = file.listFiles();
			for (int i=0; i<children.length; ++i) {
				removedCount += removeOrphanFiles(nonOrphans, children[i]);
			}
			if (nonOrphans.get(file) == null) {
				log("Removing orphan directory: "+file, Project.MSG_DEBUG);
				file.delete();
				++removedCount;
			}
		}
		else {
			if (nonOrphans.get(file) == null) {
				log("Removing orphan file: "+file, Project.MSG_DEBUG);
				file.delete();
				++removedCount;
			}
		}
		return removedCount;
	}

to cause it to remove orphaned directories.  This works perfectly (in function)
however, the messages printed to the screen are now incorrect, as it counts the
removed directories as files.  I'm not very familiar with ant tasks, and the
syntax of writing the log output, and I'm not sure how the author would like to
fix this.  Suggestions?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>