Rename/Move File in SFTP Server - WeOnlyDo Discussion board

Rename/Move File in SFTP Server (General questions)

by Anyz, Friday, September 03, 2004, 13:56 (7187 days ago)


While using rename method of SFTPDlxCom if file with same name already exists it throws the error. Is it possible to override the default behaviour to overwrite the existing file while renaming/moving?

Re: Rename/Move File in SFTP Server

by wodSupport, Friday, September 03, 2004, 14:49 (7187 days ago) @ Anyz

Anyz,

actually, client is hopeless here. All we can do is follow your command - try to rename the file. We don't know what will server do, we don't know server's environment, we don't know if files exist etc.. So, we cannot give any special commands to the server, or do any commands before we initiate Rename/Move. For Rename/Move, server accepts only 2 arguments - old and new name - so there's not more than that we can do.

It's all up to the server to decide what it will do with our Rename/Move request.

Kreso

Re: Rename/Move File in SFTP Server

by Raymond, Thursday, February 24, 2005, 09:06 (7013 days ago) @ wodSupport

Anyone know how to trap the error in ASP on a webserver ?
I have tried the rename method but when the destination file cannot be overwritten lasterror still is 0..
so there is no way to detect this

Re: Rename/Move File in SFTP Server

by wodSupport, Thursday, February 24, 2005, 10:02 (7013 days ago) @ Raymond

Raymond,

are you sure about this? If method isn't successful, server would return an error which will be redirected to you through LastError property. Perhaps it was successful so LastError=0?

How can we duplicate it?

Re: Rename/Move File in SFTP Server

by Raymond, Thursday, February 24, 2005, 11:09 (7013 days ago) @ wodSupport

If I try to rename a file that doesn't exist on the server it doesn't give an error.

We are still using version: 2.3.0.3 could this be the problem

Re: Rename/Move File in SFTP Server

by wodSupport, Thursday, February 24, 2005, 20:48 (7013 days ago) @ Raymond

I just tried this in SFTP protocol, command like this:

Ftp1.Rename bleh , /home/joe/blah

returned 30018 (which is correct). I also tried (just in case)

Ftp1.Rename /home/joe/bleh , /home/joe/blah

and same error was returned. Obviously, none of these files actually exist.