Post a reply

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

res74

Thanks martin! I will do that instead
res74

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

Hello!

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\WinSCP.com" ^
  /log="C:\scripts\FTPScripts\microProd.log" /logsize=10*10M /ini=nul ^
  /command ^
    "open sftp://thesite""" ^
    "lcd \\perseus\micro\active" ^
    "cd \" ^
    "get *" ^
    "rm *" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%


Any help is greatly appreciated!