Post a reply

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)


Topic review


Thanks martin! I will do that instead

Trying to Get MV to Pull File from SFTP and Move to Remote Share


I need to create a script to automatically move files from an SFTP site to a remote server share
SFTP --> \\remoteservername\directory

I've tried using the get * and then rm * but because there is a gap in time between those 2 commands, it's deleting files that are not processed already. Basically we connect to an SFTP server and just get the files on there and remove them once we have them. I have this in batch file currently and looking for some help. What I have so far:

@echo off
"C:\Program Files (x86)\WinSCP\" ^
  /log="C:\scripts\FTPScripts\microProd.log" /logsize=10*10M /ini=nul ^
  /command ^
    "open sftp://thesite""" ^
    "lcd \\perseus\micro\active" ^
    "cd \" ^
    "get *" ^
    "rm *" ^
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error

Any help is greatly appreciated!