Re: Backup problem using "cp"
On 07/05/18 04:31 AM, Richard Owlett wrote:
I gather that "cp" is then an inappropriate tool.
"tar" is inappropriate for my preferences - I was attempting to use "cp"
as there would be multiple files &/or directories as input *and* output.
I suspect long term I want "rsync" [ *MUCH* reading to do! ]
I went way too long before switching to rsync. I always thought that
the command-line parameters were too complex (the man page _does_ get a
bit intimidating). However, I've come up with a standard that works
well enough to tide me over until I really study it:
rsync -avzh --delete -n <fromdirectory> <todirectory>
Note the -n parameter; it causes rsync to go through the motions but not
actually do anything. You'll get a complete list of what it would have
done on stdout, followed by the message "DRY RUN". Once you're happy
with what you see, repeat the command without the -n and away you go.
(The --delete parameter tells rsync to delete any file in the output
directory that isn't in the input directory; you may or may not want this.)
Someday in my copious free time (hah!) I'll study how to tell it not to
back up those hundreds of browser cache files when backing up /home.
But for now it works well enough, and is still much faster than cp.
firstname.lastname@example.org (Charlie Gibbs)