Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Do we have any option in scp that I could copy a sparse file ?

The following command works with ssh, But I am looking for an option in SCP which copies a sparse file.

tar -Szcf - /home/myself/test/ | \
  ssh myself@myserver 'tar -C /home/myself/test_scp -zvxf -'
share|improve this question

migrated from May 22 '12 at 13:00

This question came from our site for professional and enthusiast programmers.

scp doesn't support sparse files. Use rsync instead.

rsync -aS /home/myself/test/ myself@myserver:
share|improve this answer
Thanks for the response. Rsync does via ssh. But I am looking exactly for sparse file copy using 'scp' command – Kiranjith Tg May 7 '12 at 8:47
Thanks, this solved my dilemma. – kwutchak Nov 29 '12 at 11:56

You should be able to do it also through SFTP, though I don't know any SFTP client supporting that feature.

Update: I have added that feature into the development version of my Perl module Net::SFTP::Foreign. In example:


use strict;
use Net::SFTP::Foreign;

@ARGV == 3 or die <<EOU;
  sparse_put <host> <src> <dst>

my ($host, $src, $dst) = @ARGV;

$s = Net::SFTP::Foreign->new($host, autodie => 1);
$s->put($src, $dst, sparse => 1);
share|improve this answer
will this be possible using the native SFTP client in Linux ? Do u have the syntax for the sftp command ? – Kiranjith Tg May 7 '12 at 8:49
no, but see my updated post – salva May 7 '12 at 9:56

Just add this option to scp:


It's listed on cp man page, but also works for scp.

share|improve this answer

You can add


to scp command, but it will copy regular file on the other side (no sparse).

share|improve this answer

You must log in to answer this question.

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