Starting sftp
The command for starting sftp is as follows:
ComputerName:~# sftp user@host
Few Commands :
ls - list files in the current directory on the ftp server
lls - list files in the current directory on your machine
pwd - print the current directory on the ftp server
lpwd - print the current directory on your machine.
exit - exit from the sftp program.
GET Command:
The get command in sftp allows you to download files from the sftp server.
Usage: get remote-path [local-path]
For example, to download a file named "foo.bar", the following command would be used:
sftp>get foo.bar
To download this file and save it as "readme.txt", the following command would be used:
sftp>get foo.bar readme.txt
Getting Multiple Files
To download more than one file from the sftp server use the mget command.
mget works by expanding each filename listed and running a get command on each file. The files are copied into the local working directory, which can be changed with the lcd command.
For example, to download all the files in the remote working directory, the following command would be used:
sftp> mget ./*
To download all of the files ending with .txt the following command would be used:
sftp> mget ./*.txt
Recursive Copy with SCP
Note: scp is a separate program and must be executed from the Unix command line prompt. NOT within the SFTP client.
Usage: scp copy_from copy_to
For example, if you wanted to copy the file "foobar.txt" from the remote location to your own computer, use the command:
scp user@sftp.cae.wisc.edu:/path/to/foobar.txt /some/local/directory
Likewise, if you wanted to copy the file "foobar.txt" from your own computer to your CAE remote files, use the command:
scp /path/to/foobar.txt user@sftp.cae.wisc.edu:/some/remote/directory
#! /bin/bash
sftp oracle_uxtrn360_rocs@ftpdev1.intra.schneider.com <<EOF
cd basecsv
lcd /tmp/ftp
get *.csv abc.csv
EOF
Comments
Post a Comment