Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com May 22 '12 at 13:00

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

3 Answers 3

Scp don'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:

#!/usr/bin/perl

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

@ARGV == 3 or die <<EOU;
Usage:
  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

Also look at http://www.virtsync.com which was written explicitly to deal with the shortcomings of rsync --sparse --inplace.

share|improve this answer

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.