I have written for my own use a couple of enhancements to <ftp> i would like to see integrated into ant distribution. I have added "rmdir" and "deltree" actions. "rmdir" makes, well, what it says, removes from the remote server all the directories matched by the filesets. "deltree" is a pseudo action that is internally exploded in a "delete" and "rmdir" action using the same filesets. More explanations are given in the updated documentation. Patches are included. I couldn't use cvs diff, because i'm behind a firewall and cannot access your cvs server. I used GNU diff -u to produce patches files.
Created attachment 3112 [details] "rmdir" action patch
Created attachment 3113 [details] "rmdir" action patch
Created attachment 3114 [details] "deltree" action patch
Created attachment 3115 [details] "deltree" action patch
Patch for "rmdir" action: attachment 3112 [details] : patch for jakarta-ant-1.5\src\main\org\apache\tools\ant\taskdefs\optional\net\FTP.java attachment 3113 [details] : patch for jakarta-ant-1.5\docs\manual\OptionalTasks\ftp.html Patch for "deltree" action (need previous patch as prerequisite): attachment 3114 [details] : patch for jakarta-ant-1.5\src\main\org\apache\tools\ant\taskdefs\optional\net\FTP.java attachment 3115 [details] : patch for jakarta-ant-1.5\docs\manual\OptionalTasks\ftp.html Pls let me know if you plan to include this into ant distribution since i'd like to implement some production procedures based on this behaviour.
I've committed the first part but am reluctant on the second as it changes the published API of this task (and there already is at least one user written subtask of this I am aware of). can you rework the patch to preserve transferFiles(FTPClient, FileSet)?
Well, Stefan, you are rigth. I don't like it myself the way i implemented it. It was a quick and dirty work. I thought of a different way, and i'll try to implement it when i get some new spare time, but i'd like an advice. Do you think is better to keep the "deltree" action that doesn't correspond to any real FTP command or adding an attribute, like deltree="true/false", to "delete" and "rmdir" to say: when true don't limit yourself to files or dirs but delete everything selected by the filesets? I would prefer the second way, but i'll stick with your decision. One more thing, i have implemented a couple more attributes: "purgeRemoteAfterSend" that together with "send" action, i use to maintain in sync local an remote directories, in the sense that everything that was not selected for send is deleted from remote server, so i end with specular local and remote trees. "dryrun" that just simulate execution without doing anything. When used with verbose it produce a complete report of what it would have done. I find it very useful expecially when deleting or removing to test filesets patterns. They work for me but the code is not yet clean enough for a submission. Do you think you may be intererested in this? Thanks, Gabriele.
Well, if we follow the attribute route you line out, we could also simply drop rmdir again and tell delete to work on files, directories or both of them. For your second option I would never use ftp for this, but simply rely on rsync, which even works over ssh. I haven't tried, but maybe using a <present> selector with the delete action works here (so you'd end up writing two <ftp>s in your build file).