You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Nation, Carey" <Ca...@turner.com> on 2008/05/28 21:40:46 UTC

[net:ftp] How do I obtain the target file size of a symlink?

I'm using commons net FTPClient to transfer files.  I need to download
the file, muck about with it a bit, and upload the result.  The files
are/can be quite large, so I want to be able to log the progress of my
transfers.  As there doesn't seem to be any direct hooks to do such a
thing, I thought that I'd just compare the original file size with the
size of the growing destination to see how far along the transfer is.

 

My problem is that the file I'm downloading is a symlink.  Well, the
target of a symlink, so FTPClient.listFiles() quite happily tells me
that my 20g file is 33 bytes.  The FTPFile object will tell me if the
thing is a symlink, but I don't see anything about how to get the true
size of it.  I can, of course, parse the path, cd there (no permissions
reasons why that wouldn't work), and just ask for the size since FTPFile
will tell me where the file is, but that is somewhat stinky.  Is there a
better way?

 

Thanks!

 

________________________________

Carey Nation <ma...@cnn.com>  

Lead Software Engineer

CNN BEST

Broadcast Production Systems

Video Solutions Group

(404)827-2935 (wk)

(404)824-0033 (cell)

________________________________