get sftp file code example

Example: sftp get file

# Connexion to default port 22
sftp your_user@your_server_ip_or_remote_hostname
# SFTP get local directory
sftp> lpwd
sftp> lls			# list of files in local directory
sftp> lcd mydir		# change local directory
# SFTP get remote directory
sftp> pwd
sftp> ls			# list of files in remote directory
sftp> cd mydir		# change remote directory
# put single file from local to remote directory
sftp> put myfile
# put multiple files from local to remote directory
sftp> mput *.txt
# get single file from remote to local directory
sftp> get myfile
# put multiple files from remote to local directory
sftp> mget *.txt