Was hoping someone could test this chunk of code for me on their local ftp server and see if it renames a just uploaded file such as 2.txt to 3.txt. (I want to be able to mark files as completely uploaded by changing their extension eventually)
When I try it the RTNO command says it needs the RNFR command which is what I sent previously and was accepted without error.
Log Output:
renamefrom //tmp//attachments//2.txt
command=RNFR
success=true
replyCODE=350
replystring=Ready for RNTO.
renameto //tmp//attachments//3.txt
command=RNTO
success=false
replyCODE=0
replystring=Error: RNFR required first.
When I try it the RTNO command says it needs the RNFR command which is what I sent previously and was accepted without error.
Log Output:
renamefrom //tmp//attachments//2.txt
command=RNFR
success=true
replyCODE=350
replystring=Ready for RNTO.
renameto //tmp//attachments//3.txt
command=RNTO
success=false
replyCODE=0
replystring=Error: RNFR required first.
B4X:
Sub ftp2_UploadCompleted (ServerPath As String, Success As Boolean)
Log ("serverpath=" & ServerPath)
Log ("success=" & Success)
If Success = False Then
Log(LastException.Description)
Else
Log ("Successfull")
End If
renamefrom = ServerPath
renameto=renamefrom.Replace("2","3")
Log("renamefrom " & renamefrom)
ftp2.SendCommand("RNFR", renamefrom)
End Sub
Sub ftp2_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
Log ("command=" & Command)
Log ("success=" & Success)
Log ("replyCODE=" & ReplyCode)
Log ("replystring=" & ReplyString)
Select Case True
Case Command="RNFR"
Log("renameto " & renameto)
ftp2.SendCommand("RNTO", renameto)
End Select
End Sub