Need help with deleting file from server

Advertisement

marleymar
Joined:
Posts:
1

Need help with deleting file from server

Hello,

First time WinSCP use, I've created a script to remove files from an FTP server. I'm using a batch file to apply the script to multiple servers, the problem is the batch is only applying the script to the 1st server listed. can someone take a look at my batch code to see if I am missing something?

Thanks!
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com"
  /log="C:\Users\trainee\Desktop\CrestronFW\ResultsDelete.log" /loglevel=-1 /ini=nul
  /command^  
    winscp.com /script="C:\Users\trainee\Desktop\CrestronFW\FWremove.txt" /parameter ftp://anonymous:anonymous%40example.com@10.1.105.17/
    winscp.com /script="C:\Users\trainee\Desktop\CrestronFW\FWremove.txt" /parameter ftp://anonymous:anonymous%40example.com@10.1.105.25/
    winscp.com /script="C:\Users\trainee\Desktop\CrestronFW\FWremove.txt" /parameter ftp://anonymous:anonymous%40example.com@10.1.105.33/
    winscp.com /script="C:\Users\trainee\Desktop\CrestronFW\FWremove.txt" /parameter ftp://anonymous:anonymous%40example.com@10.1.105.46/
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%

Reply with quote

Advertisement

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

Re: Need help with deleting file from server

You are trying to call WinSCP from WinSCP. That cannot work.

It should be like:

winscp.com /log="C:\Users\trainee\Desktop\CrestronFW\ResultsDelete.log" ^
  /loglevel=-1 /ini=nul ^
  /script="C:\Users\trainee\Desktop\CrestronFW\FWremove.txt" ^
  /parameter ftp://anonymous:anonymous%40example.com@10.1.105.17/
 
winscp.com /log="C:\Users\trainee\Desktop\CrestronFW\ResultsDelete.log" ^
  /loglevel=-1 /ini=nul ^
  /script="C:\Users\trainee\Desktop\CrestronFW\FWremove.txt" ^
  /parameter ftp://anonymous:anonymous%40example.com@10.1.105.25/
...

Reply with quote

Advertisement

You can post new topics in this forum