copy files to external HDD
Bill Vance
kbun at xpresso.seaslug.org
Tue Jan 13 13:39:06 UTC 2015
On Tue, 13 Jan 2015, Stephen Morris wrote:
> On 01/12/2015 10:27 PM, A.J. Bonnema wrote:
>> On 12-01-15 12:18, A.J. Bonnema wrote:
>>> Uhmmmm. They *are* comprehensible, you just need an open mind toward
>>> them. It may help to have someone in your environment who is
>>> experienced in this area. Otherwise, youtube often helps. The command
>>> you need is cp, but beware: it overwrites without warning. Also, for
>>> recursive dive into directories you need a parameter (probably -i).
>>> Check "man cp" before you do anything, and do a trial run on a dummy
>>> target directory before you do the "real thing".
>>
>> Sorry, mistyped: it's "cp -r <source> <dest>" in stead of "-i". I
>> should have checked the man-pages first.
> If using the command line you could use "cp -Rf <source> <dest>" which
> will recursively copy directories and overwrite both directories and
> files if they exist on the destination.
Just to clear a few things up, here's how some of the options work:
-R or -r will make recursive copies, i.e., all the subdirs and files
included.
--preserve=all will keep all the modes, links, and ownerships, etc., the
same as in the original directories.
-u or --update will copy a file only if it is newer than an existing file
with the same name, or if that file doesn't exist in the target dir.
These are great options for making proper backups, as well as restoring
them later.
That being said, there's a couple of starting usages:
cp -R --preserve=all /path/dir-1 /path/newdir/dir-2
will result in: /path/newdir/dir-2/dir-1
cp -R --preserve=all /path/dir-1/* /path/newdir/dir-2
Note the, "*", which results in dir-2 having the contents of dir-1, but
not creating the dir-1 directory in /path/newdir/dir-2. The, "*",
character is a, "wild card", character meaning, "any or all", and can
be used as part of a file/dir name when searching or listing, too.
When making a backup of a dir that you've allready made backups of, add
the -u or --update option, like this:
cp -R --preserve=all -u /path/dir-1/* /path/newdir/dir-2
Bill
More information about the kubuntu-users
mailing list