Automated Secure File Transfer Script

You can set up automated file transfer between Tectia Client and Server hosts using scripts.

When Tectia Server is used for automated file transfer, separate user accounts can be created for the file transfer users. Non-interactive authentication with public keys and scripted commands are then set for these accounts, and the file transfers are carried out as the current user.

The following example script first transfers testfile from Tectia Client to Tectia Server and then transfers the file back. The script logs the command and the return values to a file.

@echo off
REM Transfer file from localhost to and back

set logfile=C:\SCP-logs\scpg3_%SRV%

echo Script started %date% %time% >> %logfile%

REM This 'scpg3 put' command transfers the file from client to server.
echo scpg3.exe -B -q testfile.dat %SRV%:test >> %logfile% 
scpg3.exe -B -q testfile.dat %SRV%:test 
echo Result: %ERRORLEVEL% >> %logfile%

REM This 'scpg3 get' command fetches the file from server to client.
echo scpg3.exe -B -q %SRV%:test test >> %logfile% 
scpg3.exe -B -q %SRV%:test test 
echo Result: %ERRORLEVEL% >> %logfile%

echo Script ended %date% %time% >> %logfile% 
echo *** >> %logfile%