Post a reply :: Support Forum

Tip: Styles can be applied quickly to selected text.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Move all files between the same sftp server

mv * /incoming/out/processed/

I do not know what the purpose of *.gpg mask, as you have not mentioned that in your post.

---

Though the above solution is not transactionally safe. If new files are added during download, it will move even those files, although they were not downloaded.

There's an example for transactionally safe upload, with use of PowerShell script and WinSCP .NET assembly.
You can base your solution on that:
https://winscp.net/eng/docs/script_local_move_after_successful_upload
Invitado

Move all files between the same sftp server

Hi!

I need to copy files from a sftp server to our server, and then, move the files in the original dir to a subdir.

open sftp://user:password@server
cd /incoming/out
option exclude "processed/"
lcd \\server\sftp\IN\
mget *
close

Thats the part that works ok. But i dont know how to make the second step.

Maybe creating a mask? Something like this

cd
cd /incoming/out
put -filemask="|*/" *.gpg
mv *.gpg /incoming/out/processed/

give me the log message:

* 2017-05-15 15:10:00.919 (ETerminal) Permission denied.
* 2017-05-15 15:10:00.919 Error code: 3
* 2017-05-15 15:10:00.919 Error message from server: Permission denied
. 2017-05-15 15:10:00.919 Asking user:
. 2017-05-15 15:10:00.919 Cannot overwrite remote file '/incoming/out/file'.$$
. 2017-05-15 15:10:00.919
. 2017-05-15 15:10:00.919 Press 'Delete' to delete the file and create new one instead of overwriting it.$$ ("Permission denied.
. 2017-05-15 15:10:00.919 Error code: 3
. 2017-05-15 15:10:00.919 Error message from server: Permission denied")
< 2017-05-15 15:10:00.919 Script: Cannot overwrite remote file '/incoming/out/file'.
< 2017-05-15 15:10:00.935 Script: Permission denied.
< 2017-05-15 15:10:00.935 Error code: 3
< 2017-05-15 15:10:00.935 Error message from server: Permission denied
* 2017-05-15 15:10:00.935 (EScpSkipFile) Cannot overwrite remote file '/incoming/out/file'.$$
* 2017-05-15 15:10:00.935
* 2017-05-15 15:10:00.935 Press 'Delete' to delete the file and create new one instead of overwriting it.$$
* 2017-05-15 15:10:00.935 Permission denied.
* 2017-05-15 15:10:00.935 Error code: 3
* 2017-05-15 15:10:00.935 Error message from server: Permission denied
. 2017-05-15 15:10:00.935 Script: Failed
. 2017-05-15 15:10:00.935 Script: Exit code: 1
. 2017-05-15 15:10:00.935 Closing connection.
. 2017-05-15 15:10:00.935 Sending special code: 12
. 2017-05-15 15:10:00.935 Sent EOF message


Can you help me?

Regards!