in reply to Net::FTP incomplete downloads

You could ask the remote server for the size (using the size() method) of the file before (and possibly after) you download it. If the sizes don't match up, just redo it.

Btw, are your files actively in use when you are downloading them? That might explain why occasionally you get an incomplete download.

Replies are listed 'Best First'.
Re^2: Net::FTP incomplete downloads
by vortmax (Acolyte) on Apr 23, 2008 at 19:17 UTC
    i didn't even think about the size() method. I was thinking it would be nice to have an md5 checksum, but that might do the trick. I'll have to code it up and test it.
    There is a possibility that the files are being accessed while I'm downloading, but it would be read only. Would another process attempting to read the file abort the ftp download?

    edit:
    I tried invoking the size method in the script, and was met with this error:
    Net::FTP=GLOB(0x8743d84)>>> HELP SIZE
    so I login to the server manually and attempt the size command , and apparently the server doesn't support it. It's a vxworks (5.2.4) based system if that helps.
      Perhaps you can retrieve a directory listing and get the file size from that. I'd try the "dir" method.