I'm looking for the difference between
cp -r and
cp -a. What does "recursive" mean in terms of copying files from a folder?
Recursive means that
cp copies the contents of directories, and if a directory has subdirectories they are copied (recursively) too. Without
cp command skips directories.
-r is identical with
-R on Linux, it differs in some edge cases on some other unix variants.
cp creates a new file which has the same content as the old file, and the same permissions but restricted by the umask; the copy is dated from the time of the copy, and belongs to the user doing the copy. With the
-p option, the copy has the same modification time, the same access time, and the same permissions as the original. It also has the same owner and group as the original, if the user doing the copy has the permission to create such files.
-a option means
-p, plus a few other preservation options. It attempts to make a copy that's as close to the original as possible: same directory tree, same file types, same contents, same metadata (times, permissions, extended attributes, etc.).
The -r or -R option for "recursive" means that it will copy all of the files including the files inside of subfolders.
The -a option as listed is the same as -dR which means it will preserve links as well as copy the contents of subdirectories. What it means by preserving links is that it will not follow links as it is recursively copying.