Delete a file on the server
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzFtpClient::FileDelete | (hzString&,) |
Declared in file: hzFtpClient.h
Defined in file : hzFtpClient.cpp
Function Logic:
Function body:
hzEcode hzFtpClient::FileDelete (hzString& SvrFilename)
{
// Delete a file on the server
//
// Arguments: 1) SvrFilename Name file has on the server
//
// Returns: E_HOSTFAIL If there was a communication failure and reconnect failed
// E_WRITEFAIL If the remote file was not deleted
// E_OK If the remote file was deleted
_hzfunc("hzFtpClient::FileDelete") ;
uint32_t nRecv ; // Length of server response
uint32_t len ; // Length of client request
uint32_t nTry ; // Reconnection retry count
hzEcode rc ; // Return code
/*
** ** Send DELE command and receive resposns, reconnect if required.
** */
for (nTry = 0; nTry < 2; nTry++)
{
if (nTry == 1)
{
m_ConnControl.Close() ;
rc = _reconnect() ;
if (rc != E_OK)
break ;
}
/*
** ** Send the DELE command and check the response
** */
sprintf(m_c_sbuf, "DELE %s\r\n", *SvrFilename) ;
len = strlen(m_c_sbuf) ;
if ((rc = m_ConnControl.Send(m_c_sbuf, len)) != E_OK)
{
threadLog("Could not send DELE command (for file %)\n", *SvrFilename) ;
continue ;
}
if ((rc = _ftprecv(nRecv, *_fn)) != E_OK)
{
threadLog("Could not recv DELE response (for file %)\n", *SvrFilename) ;
continue ;
}
break ;
}
/*
** ** Check server response
** */
if (m_nRescode >&eq; 400)
{
threadLog("Got bad response (%d) to DELE %s\n", m_nRescode, *SvrFilename) ;
return E_NODATA ;
}
return E_OK ;
}