LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-12-2019, 05:13 AM   #1
shamjs
Member
 
Registered: Sep 2011
Posts: 89

Rep: Reputation: Disabled
What is the efficient way to remotely copy a tar.gz file or a folder contents over a network in c++ programmatically


Hi,

I need to copy an entire directory from one host to other programmatically in C++.

My directory contains different file types like .dlt .png etc..

I am ok with either

1. taring the entire directory and copy the tar file to a remote machine.

Or

2. copying the directory as such.

my directory size range between 400 to 500MB

Please throw some light on this, to proceed further.

Also i appreciate if you share some code snippets to achieve the same.
 
Old 08-12-2019, 05:58 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 12,943

Rep: Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080
did you try to look for a solution on the net?
the language is more or less irrelevant, the implementation depends on your connection and connection type.
you can use scp, ftp, rsync, nfs, samba or something else.
 
Old 08-12-2019, 10:29 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,803

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
Guess it would be a "tar -czf - ... | ssh ... 'tar -xzf -'" pipeline, called with system(3).
 
Old 08-12-2019, 11:32 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,674

Rep: Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734
Quote:
Originally Posted by shamjs View Post
Hi,
I need to copy an entire directory from one host to other programmatically in C++.

My directory contains different file types like .dlt .png etc.. I am ok with either

1. taring the entire directory and copy the tar file to a remote machine.

Or

2. copying the directory as such.

my directory size range between 400 to 500MB Please throw some light on this, to proceed further. Also i appreciate if you share some code snippets to achieve the same.
After asking about programming for years now, it's odd that you need us to provide you with code. Here's a better suggestion: why don't YOU post the code that YOU have written, and tell us why it's giving you a problem? Read the "Question Guidelines"...we are happy to help, but we aren't going to do your work/homework for you. Show your efforts.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
want to 'tar' a folder without some contents of folder shipon_97 Linux - Newbie 5 10-13-2007 04:21 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
How do I un tar a .tar, .tar.z, .tar.gz file vofkid Linux - Newbie 4 03-15-2002 02:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration