Need to execute a program on the FTP server after uploading files. Need Help

Advertisement

ap69
Joined:
Posts:
2
Location:
denmark

Need to execute a program on the FTP server after uploading files. Need Help

Im executing the WinSCP from the ERP system and in the ftpup.txt I'm scripting the transfer.

How to execute a BAT OR EXE file in the script file?
P:\C5BMSQL\FTP\RS\FTP\WinSCP.com /script=P:\C5BMSQL\FTP\RS\FTP\ftpup.txt
option batch abort
option confirm off
option transfer binary
open ftp://XXX:XX
lcd "P:\C5BMSQL\FTP\RS\Export\"
 
cd "/MasterData/"
ls
rm "*.csv"
put "*Base*.csv"
 
cd "/OrderData/"
ls
rm "*.csv"
put "*OrderStatus*.csv"
 
# Want to execute a .Bat file og .Exe file here.
 
close
exit

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: Need to execute a program onthe FTP server after uploading files. Need Help

Some, but very few, FTP servers support SITE EXEC command. In the very rare case that your FTP server does support it, you can use:
call SITE EXEC my.exe
Though, in most cases, you cannot execute anything on the FTP server, if FTP is the only way you can access the server. You would have to use another method to execute the script, like SSH, PowerShell Remoting, etc.

Reply with quote

ap69
Joined:
Posts:
2
Location:
denmark

Hi Martin

Thanks

Do you have any whitepaper on executing PowerShell remoting.

Just need a push to get started :)

The solution I'm looking for is to execute a Bat file that starts up a program, after upload, and imports data.

Thanks

Reply with quote

martin
Site Admin
martin avatar

I have no experience with PowerShell remoting. But first, you need to find out if your server does even support it.

Reply with quote

Advertisement

You can post new topics in this forum