Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Created February 2, 2017 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssokolow/b3752bfab83e31c48b2263da0370bddb to your computer and use it in GitHub Desktop.
Save ssokolow/b3752bfab83e31c48b2263da0370bddb to your computer and use it in GitHub Desktop.
Example scripts for easily sending/receiving files using the SSH2DOS SFTP client
@echo off
REM Usage:
REM 1. Set up your DOS network and packet drivers
REM 2. Install sftpd386.exe
REM 3. Edit the line which calls sftpd386.exe for path/credentials/IP address
REM 4. Run "sftpget file1 file2 file3 ..."
REM Write sftp script
(
@echo off
echo cd writable
FOR %%A in (%*) DO echo get %A
echo bye
) > %TEMP%\sftpscri.pt
REM Pipe it as input because -b doesn't seem to get along with -i
c:\apps\ssh2\sftpd386.exe -i c:\apps\ssh2\id_rsa nostalgia-exchange@192.168.0.2 < %TEMP%\sftpscri.pt
REM Delete the sftpscript
del /Q %TEMP%\sftpscri.pt
@echo off
REM Usage:
REM 1. Set up your DOS network and packet drivers
REM 2. Install sftpd386.exe
REM 3. Edit the line which calls sftpd386.exe for path/credentials/IP address
REM 4. Run "sftpsend file1 file2 file3 ..."
REM Write sftp script
(
@echo off
echo cd writable
FOR %%A in (%*) DO echo put %A
echo bye
) > %TEMP%\sftpscri.pt
REM Pipe it as input because -b doesn't seem to get along with -i
c:\apps\ssh2\sftpd386.exe -i c:\apps\ssh2\id_rsa nostalgia-exchange@192.168.0.2 < %TEMP%\sftpscri.pt
REM Delete the sftpscript
del /Q %TEMP%\sftpscri.pt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment