Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
I was trying with scp before. It looks like I had a typo. TY! –  Marek Dec 15 '12 at 12:54

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/
share|improve this answer
    
Note that this requires rsync to be installed on both machines. –  Frands Hansen Dec 2 '12 at 0:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.