Session.MoveFile issues

Advertisement

qb
Joined:
Posts:
5

Session.MoveFile issues

Ok, so I've figured out a few things, but this is strange.
According to what I have read Move File is pretty easy.
Session.MoveFile(source,target)

Well, I picked transfer.filename for the source. I do an upload (push) then go into an IF , if I have no errors.
In my IF i am trying to do a session.movefile(transfer.filename, target).

My target fails every single time.
I tried creating a string var and giving it a local path.
I tried @"c:\dir\*"
I tried "c:\\dir\\*"
I tried "c:/dir/*"
I tried "dir/*"
I tried "/dir/*"

With and with out the *...you get the idea. Side bit of info,
when ever i tried to plug in the source as in @"C:/dir?*" (or others...I'd always get "Element mv not found". So I figured if the transfer.filename worked I'd run with it.

Ok, back to teh issue at hand, the error I always get for the target is "path not found".
Any ideas?
Thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Session.MoveFile issues

Not sure what you are trying to do. Are you aware that Session.MoveFile is for moving/renaming remote file to another remote folder or name?
You cannot use it with local files.
https://winscp.net/eng/docs/library_session_movefile

If you are trying to move a local file to a remote directory, use Session.PutFiles and set remove argument to true.
https://winscp.net/eng/docs/library_session_putfiles

when ever i tried to plug in the source as in @"C:/dir?*" (or others...I'd always get "Element mv not found". So I figured if the transfer.filename worked I'd run with it.
That's looks like a bug (no matter if you used Session.MoveFile incorrectly. Please attach a code and full debug log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.DebugLogPath. Submit the log with your post as an attachment. If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum