By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,470 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,470 IT Pros & Developers. It's quick & easy.

FTP RenameRemoteFile fails with 501 error

P: n/a
I am sure some of you have used the FTP code that is floating on the web.

This particular function give me an error and I am not sure what the
parameters are that it expects.

My code:
ANSFTP.RemotePath = /u1/ans/
ANSFileName = xyz.gpg

ANSFTP.RenameRemotefile(ANSFTP.RemotePath & ANSFileName.Trim, _
ANSFTP.RemotePath & "Archive/" & ANSFile.Trim)

The function:
'/// Rename as file on the remote server.
Public Function RenameRemotefile(ByVal OldFilename As String, _
ByVal NewFilename As String) As Boolean
Dim MyResult As Boolean = True

If (Not (m_LoggedIn)) Then Login()

SendCommand("RNFR " & OldFilename)

If (m_ReturnValue <> 350) Then
MessageString = m_Reply
Throw New IOException(m_Reply.Substring(4))
End If

'/// Known problem - RNTO will not take care of existing file.
'/// I.E. It will overwrite if newFileName exists

SendCommand("RNTO" & NewFilename)

If (m_ReturnValue <> 250) Then
MessageString = m_Reply
Throw New IOException(m_Reply.Substring(4))
End If

Return MyResult
End Function

And ideas on why I get this error
501 wrong number of parameters

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.