commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nation, Carey" <>
Subject [net:ftp] How do I obtain the target file size of a symlink?
Date Wed, 28 May 2008 19:40:46 GMT
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?





Carey Nation <>  

Lead Software Engineer


Broadcast Production Systems

Video Solutions Group

(404)827-2935 (wk)

(404)824-0033 (cell)



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message