Archived Forum Post

Index of archived forum posts

Question:

Moving files in SFTP fileserver

Jul 27 '13 at 21:21

If I’m not mistaken, the function to move a file in Chilkat’s sftp object is to use ‘RenameFileOrDir’. But when I try to move a file from ‘TestFolder’ to ‘TestFolder2’ I get the error below. The test text file is in that location. How can I move this file?

ChilkatLog:
RenameFile:
DllDate:Jul 8 2013
ChilkatVersion: 9.4.1.25
UnlockPrefix: {my unlock code}
Username: xxxx
Architecture: Little Endian; 32-bit
Language: .NET 2.0
VerboseLogging: 0
SshVersion: SSH-2.0-1.36_sshlib GlobalSCAPE
SftpVersion: 3
oldFilename: /ftpjustin/TestFolder/testText.txt
newFilename: /ftpjustin/TestFolder2/testText.txt
StatusResponseFromServer:
Request: FXP_RENAME
InformationRecievedFromServer:
StatusCode: 2
StatusMessage: File not found
--InformationRecievedFromServer
--StatusResponseFromServer
Failed.
--RenameFile
--Chilkat Log


Answer

Maybe the server is interpreting all paths as relative to the user account's HOME directory. Try a path that is relative to the HOME directory instead.

Also, you can always find out the exact absolute path as the server understands what you are passing by testing with the Chilkat.SFtp.RealPath method. See http://www.example-code.com/csharp/sftp_realPath.asp

For example:

string absPath = sftp.RealPath("/ftpjustin/TestFolder/testText.txt","");