Search results
Results from the WOW.Com Content Network
The way I am envisioning this is to have a script sitting on a server that will be triggered by Windows Task scheduler to run at a specific time (Tuesday) that will grab the file in question upload it to the SFTP and then move it to a different location for backup purposes. For example: Local Directory: C:\FileDump. SFTP Directory: /Outbox/
I was looking through the options today using man sftp in an attempt to figure out a way to run the following commands basically in a single line so that I don't have to type a command, press enter, type a command press enter, etc. (what I do now) sftp myuser@myserver --mypassword at prompt lcd /tmp get /dir/dir/dir/dir/file quit
Another way would be to use lftp: lftp sftp://user:password@host -e "put local-file.name; bye" The disadvantage of this method is that other users on the computer can read the password from tools like ps and that the password can become part of your shell history.
Forcing the use of the SCP protocol may be necessary for servers that do not implement SFTP, for backwards-compatibility for particular filename wildcard patterns and for expanding paths with a ‘~’ prefix for older SFTP servers. HISTORY Since OpenSSH 9.0, scp has used the SFTP protocol for transfers by default.
First, make sure you understand, if you need to use Secure FTP (=FTPS, as per your text) or SFTP (as per tag you have used). Neither is supported by Windows command-line ftp.exe. As you have suggested, you can use WinSCP. It supports both FTPS and SFTP. Using WinSCP, your batch file would look like (for SFTP):
I don't know how sftp was configurable when this question was asked. Anyway, 6 years later, you can put sftp-commands like PUT into a file and then reference this file in your initial sftp-call. The makes the whole process completely non-interactive and easily configurable:
To run batch script either pass script file using /script parameter or specify the commands directly on command line using /command. In the latter case each following parameter is treated as single command. See syntax section and examples below for details how to deal with spaces and double-quotes.
In addition to graphical interface, WinSCP offers scripting/console interface with many commands. The commands can be typed in interactively, or read from script file or another source. Using scripting interface directly is recommended for simple tasks not requiring any control structures. For complex tasks, using WinSCP .NET assembly is preferred.
To automate operation, you need to find out commands necessary to implement it. For simple operations you need at least to: Open session using open command. Perform operation. For uploads use put command. For downloads use get command. For synchronization use synchronize command. For other operations, see supported commands. Exit scripting ...
I'm trying to download a file from sftp site using batch script. I'm getting the following error: Permission denied (publickey,password,keyboard-interactive). Couldn't read packet: Connection rese...