-1

What does the -a option do in the cp command?

I thought that the -a does not preserve the structure of directories. But, I have never found a case where the structure of directories has been destroyed by the -a option.

is there such a case where the structure of directories has been destroyed by the -a option? Thanks.

Jens
  • 69,818
  • 15
  • 125
  • 179
makansij
  • 9,303
  • 37
  • 105
  • 183

2 Answers2

0
       -a, --archive
          same as -dR --preserve=all

To my understanding, it should recursively copy the directories while keeping all the attributes. In which case, it shouldn't be destroying the structure at all. http://man7.org/linux/man-pages/man1/cp.1.html

Storm-
  • 147
  • 8
0

-a means 3 things:

  1. preserve timestamps, permissions, group, user (if you're running as root).

  2. preserves symbolic links (no dereference)

  3. recursive copy

read the man page, it has all info there

Nir Levy
  • 12,750
  • 3
  • 21
  • 38