Friday, July 13, 2007

obstacles

Per my last post, I have started working on an Ant script to cleanse my blog pages of Blogger's unsightly navigation bar. The most significant obstacle I am up against is the traversal of directory trees using Ant's ftp task. The ftp task allows you to specify a file set that spans sub-directories (**/*.html, etc.), but creating a listing with this pattern will result in a set of file names without relative paths:
07-10-07  01:24PM                18669 grumpy.htm
07-10-07 01:24PM 17914 neurosis.htm
07-11-07 11:24AM 18001 populism.htm
07-10-07 01:24PM 16911 three.htm
07-11-07 11:24AM 11247 atom.xml
07-11-07 11:24AM 17028 default.htm
If I try to list all artifacts in the current directory level and traverse the tree manually, I still find myself parsing a list that doesn't include directories. What bothers me is that creating a listing with an FTP client directly (using dir or ls) does show the sub-directories, so the ftp task must be filtering them out:
07-06-07  01:15PM       <DIR>          2007
07-10-07 01:11PM <DIR> archives
07-11-07 11:24AM atom.xml
07-11-07 11:24AM default.htm
07-06-07 11:56AM <DIR> images
07-06-07 01:18PM <DIR> labels
I took a look at the ftp code, and it's using the FTP client from Apache Commons. It looks like most of the magic is tied up in FTPClient.listFiles(), but a quick look at that code made it clear that a quick look would not suffice. Bother. I need to figure this out or I will not be able to re-upload the files after I've modified them.

Labels: ,

0 Comments:

Post a Comment

<< Home