Someone please help to create a script file to simply execute from my Windows Server 2008 R2 Enterprise.
I have a list of of host with IPv6 address as [X25:F0:B2:F314::02]
, [X25:F1:B2:F914::56]
so on, like 25 hosts. And from each host I need to download 300 files revenue.xml
, prodcut_growth.xml
, loss.xml
..... so on like this. While downloading for each file I want to append date and time so file will be saved as revenue_07_09_2017.xml
.
I tried by following procedure but failed:
cd "c:\Program Files\WinSCP"
winscp.com /command "open user:password@[X25:F0:B2:F314::02]" get "/home/user/revenue.xml" "C:\downloaded\revenue.xml.%TIMESTAMP#yyyymmddhhnnss%"
get "/home/user/loss.xml" "C:\downloaded\loss.xml.%TIMESTAMP#yyyymmddhhnnss%""exit"
#Second host starts here
winscp.com /command "open user:password@[X25:F1:B2:F914::56]" get "/home/user/revenue.xml" "C:\downloaded\revenue.xml.%TIMESTAMP#yyyymmddhhnnss%"
get "/home/user/loss.xml" "C:\downloaded\loss.xml.%TIMESTAMP#yyyymmddhhnnss%""exit"
exit
I tried to execute above batch file but not helped. Please suggest some approach. Your help is highly appreciated.
You can use a batch file with a sub routines:
(though you will also want to modify the target path with the host, as otherwise the files will overwrite one another)
Another option is to use Parametrized WinSCP script.