Sunday 23 July 2023

Batch script to copy newman report from windows machine to linux machine

To copy newman html report (or in general any file) from windows machine to linux machine use below batch script. 

PuTTY should be installed in the windows(source machine) and pscp.exe should be there in the installation folder and it does the job of copying files from source to destination. 



REM linux machine details 
@echo on
set SOURCE_DIR=C:\postman\newman\
set USERNAME=linuxadmin
set PASSWORD=MyPassword#123
set LINUX_MACHINE_IP=1.123.4.567
set DESTINATION_DIR=/home/%USERNAME%/AutoDrive
set FILE_PATTERN=*SmokeTestsNewmanReport.html*

REM copy files from windows to linux
pscp -pw %PASSWORD% %SOURCE_DIR%%FILE_PATTERN%  \ %USERNAME%@%LINUX_MACHINE_IP%:%DESTINATION_DIR%
timeout /t 15 /nobreak
exit

I hope you find this useful! If you like it, pls do subscribe my YouTube channel for automation or tech updates.

No comments:

Post a Comment