Forked from countnazgul/psftp_automate_sftp_server.bat
Last active
March 17, 2022 16:50
-
-
Save flatlinebb/59ac0b5185ee4158ca77261c69c16096 to your computer and use it in GitHub Desktop.
Using psftp to automate tasks from batch file to sftp server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psftp [email protected] -pw password -noagent -4 -batch -be -b commands.txt > log_file_%date:~10,4%-%date:~7,2%-%date:~4,2%-%time:~0,2%%time:~3,2%%time:~6,2%.txt 2>&1 | |
# log_file_%date:~10,4%-%date:~7,2%-%date:~4,2%-%time:~0,2%%time:~3,2%%time:~6,2%.txt = log file with a timestamp | |
# -pw = password | |
# -4 = use IPv4 | |
# -batch = disable all interactive prompts | |
# -be = don't stop batchfile processing if errors | |
# -b filename = use specified batchfile | |
# -noagent = disable use of Pageant | |
# -bc = output batchfile commands | |
# commands.txt contain all the psft commands that need to be executed like: | |
lcd c:\test | |
cd folder/sub/folder | |
mget *.gz | |
del *.gz | |
mput *.pdf | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment