Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

bmsitservices@outlook.com

sftp copy file then move file moved but not copied

Hi,

Below is the script we use to copy files it then moves the files to another directory for a clients ERP software to upload
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\temp\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://SFTP SERVER DETAILS ARE HERE"
    "get -filemask=|processed/; /production/fermexdistributors/fresho_orders/*.* c:\Capital\Capshell\CAPITAL\FRESHO_IN\Orders\*.*" ^
    "mv /production/fermexdistributors/fresho_orders/*.xml /production/fermexdistributors/fresho_orders/processed/*.xml" ^
    "exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
exit /b %WINSCP_RESULT%

the script works with the only issue being, Files are copied, then I think a new file is added just before the move command takes place. This file is then included in the move process. Example in the attached WinSCP log extract is file 0008599523_new_order_fermex_distributors_2023-11-23--10-56-25.xml.

It is not listed as being copied but listed as being moved, so the client does not receive the order.