Skip to content

Instantly share code, notes, and snippets.

@anastasiia-kornilova
Last active March 12, 2020 18:33
Show Gist options
  • Save anastasiia-kornilova/e1344f658a91449cf16217ec03147a18 to your computer and use it in GitHub Desktop.
Save anastasiia-kornilova/e1344f658a91449cf16217ec03147a18 to your computer and use it in GitHub Desktop.
@echo off
REM Usage: send_files.cmd <path to scripts dir> <file with ip addresses>
rem example: C:\\TRIKStudio\\send_files.cmd C:\Users\Dell\Desktop\send_files ip_adr.txt
Setlocal EnableDelayedExpansion
set TRIK_DIR=%~dp0
set WINSCP_PATH=%TRIK_DIR%\winscp\winscp.com
set SCRIPT_PATH=%1
SET mydir=%cd%
set PUT_ALL=
pushd "%SCRIPT_PATH%"
for %%f in (*.js) do (
set PUT_ALL=!PUT_ALL! "put %%f"
)
for /f "usebackq" %%A in ("%SCRIPT_PATH%\%2") do (
set OPEN_IP="open scp://root@%%A"
"%WINSCP_PATH%" /command !OPEN_IP! "cd /home/root/trik/scripts/" %PUT_ALL% exit < CON
)
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment