cp flags question

General support questions
Post Reply
stevesdl
Posts: 18
Joined: 2017/09/05 17:11:15

cp flags question

Post by stevesdl » 2018/07/19 20:33:01

When copying a user's files on same partition\filesystem:

What is the difference between cp -af and cp -rpf?

From my understanding and man pages -a keeps all file settings including ownership, permissions,sl and includes recursive.

Why use -rp when it is covered in -a?

thanks ahead of time

stevesdl
Posts: 18
Joined: 2017/09/05 17:11:15

Re: cp flags question

Post by stevesdl » 2018/07/20 02:22:38

Okay? might they be the same?

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: cp flags question

Post by aks » 2018/07/20 04:35:28

From man cp:

-a, --archive
same as -dR --preserve=all
-d same as --no-dereference --preserve=links
-f, --force
if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used)
-R, -r, --recursive
copy directories recursively
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all

Post Reply