Issue
I have to upload few files from my Windows machine to different Unix boxes using WinSCP software at regular intervals.
The pain is that let's say I have 4 different Unix boxes so in WinSCP I have to open that 4 different Unix boxes individually, to upload the files.
Please advise is there any software through which I can graphically open the four Unix boxes simultaneously and upload the files to the same location?
Solution
Just create a batch file that connects and uploads a file to all hosts sequentially.
With WinSCP scripting the batch file can be like:
@echo off
set UPLOAD=winscp.com /command "open %%1%%" "put ""%1""" "exit" /parameter
%UPLOAD% ftp://martin:[email protected]/home/martin/
%UPLOAD% sftp://user:[email protected]/home/user/
Now you can call the batch file (say multiupload.bat
) with a file path as an argument:
multiupload.bat c:\path\upload.txt
You can even drop/link the batch file in Explorer's "SendTo" folder to easily use it from the Explorer's "Send To" menu:
Some references:
- Guide to automating file upload to SFTP server
- A practical example for upload to a single host
- Making the script take name of file to upload as parameter to easily reuse it.
- Example for creating parametrized script to upload files:
- Creating entry in Explorer's "Send To" menu.
Answered By - Martin Prikryl Answer Checked By - Pedro (WPSolving Volunteer)