2

I would like to get large file over sftp. I execute following commands:

kopparberg:dev marek$ sftp -P 678 marek@server
marek@server's password: 
Connected to server.
sftp> cd backup
sftp> get database.gz /Volumes/www/backup/
Fetching /backup/database.gz to /Volumes/www/backup/database.gz
                                                  9%   44MB   1.4MB/s   05:06 ETA

Because it follows some more commands, I decided to write a bash script and I put sftp commands in batchfile.

Bash file looks like this:

#!/bin/bash

#get backup file
sftp -P 678 -o "BatchMode no" -b batchfile.sftp marek@server

#following commands
#...

In bacthfile.sftp are just three steps:

cd backup
get database.gz /Volumes/www/backup/
quit

The problem is that I do not see progress when I run the bash file. Is there any rational explanation behind?

2 Answers 2

2

Why don't you just use a single SCP command instead?

scp -P 678 marek@server:/backup/database.gz /Volumes/www/backup/

I also believe that using this method will give you the desired output evern when run from a script.

3
1

rsync over sftp will do that for you, no scripting required:

rsync -av --progress -e 'ssh -p 678' marek@server:backup/database.gz /Volumes/www/backup/
1
  • Note that this requires rsync to be installed on both machines. Dec 2, 2012 at 0:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .