login about faq

Is there a way to have FTP throw an error '0' when downloading a file that exists but has 0 length? I know that I can check the size via FTP but I would like to not have two ftp commands for each file that I am working with.

Thank -Erik

ChilkatLog:
  GetFile:
    DllDate: Jan 19 2012
    UnlockPrefix: SINSVISFTP
    Username: MATHIS:erik
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    localFilename: \\8.0.0.19\Archive_eCerts\1745\2005\11\415197.pdf
    ModeZ: 0
    BinaryMode: 1
    Passive transfer mode
    EPSV_reply: 229 ENTERING PASSIVE MODE (|||4297|)
    hostAddr: 207.97.225.66
    DataConnect:
      hostname: 207.97.225.66
      port: 4297
      ConnectTimeoutMs_1: 1000000
      calling ConnectSocket2
      IPV6 enabled connect with NO heartbeat.
      This is an IPV4 numeric address...
      AddrInfoList:
        AddrInfo:
          ai_flags: 4
          ai_family: 2
          ai_socktype: 1
          ai_protocol: 0
          ai_addrlen: 16
          ai_canonname: (NULL)
        --AddrInfo
      --AddrInfoList
      Connect using IPV4.
      ipAddress1: 207.97.225.66
      myIP_3: 8.0.0.3
      myPort_3: 1219
      connect successful (2)
    --DataConnect
    PassiveDataConnectionSetupTimeMs: Elapsed time: 1172 millisec
    RetrFilename: [415197.pdf]
    RETR_reply: 150 Opening BINARY mode data connection for 415197.pdf (0 bytes).
    This file is known to be 0 bytes in length.
    statusCode3: 226
    finalReply: 226 Transfer complete (0.000 KB/s).
    ReadFinalReplyTimeMs: Elapsed time: 0 millisec
    Mdtm:
      mdtm: 20060214200331
    --Mdtm
    TotalTimeMs: Elapsed time: 1860 millisec
    Success.
  --GetFile
--ChilkatLog

asked Jun 29 '12 at 21:06

emartinson's gravatar image

emartinson
148162030


If the file is truly 0 bytes, then it would be wrong to have GetFile return a failed status (0/false) if the file was successfully "downloaded". In this case, "download" means that at 0-length file is created on the client-side.

The Chilkat API's never throw exceptions. The reason is that the API's are supported across so many different programming languages and operating systems, and exceptions are not available in many programming environments. To have some piece of functionality dependent on an exception being thrown would make it non-portable to other environments.

An alternative solution might be to check the size of the local file to see if it's 0 bytes. If so, then you can delete it. This would be much quicker than a 2nd command/response round trip to the FTP server to check the file size.

link

answered Jun 30 '12 at 09:10

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Not an FTP function, it is up to the receiver and processor to handle that situation. There are many apps that have to have a zero byte file, ie Processing credit cards - process every hours, well if no one runs a card in the hour, have to have a zero byte file.

link

answered Jul 28 '14 at 14:14

cdlvj130's gravatar image

cdlvj130
9691017

For any problem, make sure to test with the latest version. If the problem still exists, post the LastErrorText using the latest version.

link

answered Jul 28 '14 at 17:57

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×131
×1

Asked: Jun 29 '12 at 21:06

Seen: 2,250 times

Last updated: Jul 28 '14 at 17:57

powered by OSQA