LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2018, 12:14 PM   #1
MSorganmorgan
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Rep: Reputation: Disabled
How to copy files between networked computers, overwriting only when newer?


Using Ubuntu 16.04 on both computers and the network set up using Samba.

I am trying to copy files from one computer to the other, overwriting only where there is a newer version. I can see the options to do this in cp, and presume the options in rcp are the same. However there is no .rhosts or hosts.equiv on either computer, and I am somewhat confused by the examples given the entry in the Linux Programmer's manual.

Do I have to set up hosts.equiv from scratch? Is there a better way to synchronise files?

All help appreciated by a very wary inexperienced linux user!
 
Old 07-12-2018, 12:19 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 & 7
Posts: 3,017

Rep: Reputation: 802Reputation: 802Reputation: 802Reputation: 802Reputation: 802Reputation: 802Reputation: 802
rsync
 
2 members found this post helpful.
Old 07-12-2018, 12:23 PM   #3
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,787

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
Suggest you not presume anything. Use
Code:
man scp
to read the manual for the scp command.

rsync, by default, only copies new or changed files. See
Code:
man rsync
 
1 members found this post helpful.
Old 07-12-2018, 01:12 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,550

Rep: Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778
I guess one could write some script that uses a set of files as input using date and then compares to other computer and if matches copy.

hosts.equv https://docs.oracle.com/cd/E19455-01...082/index.html

rsync tends to be most recommend way.

Last edited by jefro; 07-12-2018 at 08:14 PM.
 
Old 07-12-2018, 07:56 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 14,066
Blog Entries: 24

Rep: Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795Reputation: 3795
rsync -a

https://www.tecmint.com/sync-new-cha...s-rsync-linux/
 
1 members found this post helpful.
Old 07-13-2018, 04:19 PM   #6
MSorganmorgan
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Many thanks to all for the helpful replies. rsync looks the ideal tool. It takes a while to read the rsync manual, and for me, even longer to understand it! The examples are very helpful.
 
Old 07-13-2018, 04:26 PM   #7
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,787

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
rsnapshot is a wrapper for rsync that manages multiple generations of backups with minimal effort.
 
1 members found this post helpful.
Old 07-13-2018, 06:43 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 18,550

Rep: Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778Reputation: 2778
I haven't tired it but Grsync is out there. Your distro may have more in it's package manager.
 
1 members found this post helpful.
Old 07-14-2018, 07:43 PM   #9
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Linux Mint
Posts: 1,674

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by jefro View Post
I haven't tired it but Grsync is out there. Your distro may have more in it's package manager.
I've been using Grsync with Fedora. Haven't had any problems and don't have to remember a bunch of command line flags
 
1 members found this post helpful.
Old 07-16-2018, 08:56 PM   #10
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,483

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
I just replied so I could say, 'rsync', too. Grsync might be less daunting for beginners.
 
1 members found this post helpful.
Old 07-17-2018, 06:45 AM   #11
MSorganmorgan
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Many thanks to all, especially for the extremely helpful link from Farnk Bell
 
  


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
MINT. Format CD/DVD. Copy Win 7 files over to laptop - not networked. Wazzock Linux Mint 9 09-10-2014 08:59 AM
[SOLVED] Overwriting free space or overwriting single files restored by photorec fcrok Linux - Security 22 09-15-2012 12:53 PM
Copy only newer files with a bash script armywil Programming 8 03-29-2010 04:56 AM
How to copy files without overwriting? Stephan_Craft Linux - Newbie 7 02-17-2009 05:28 AM
upload using FTP WITHOUT overwriting existing/newer files HyperBlade Linux - Software 1 04-05-2008 11:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:36 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