tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposal for cp -a



> I propose to add option -a to cp(1).
> FreeBSD (since about 7.1), Linux and some other platforms have it,
> and I think it is very useful.

As Hubert noted me personally I need to explain what the purpose is.
Idea is clear, -a is equivalent to -RpP. With -a option we can easily
create an <A>rchive copy of src_dir directory by running the following
command.

   cp -a src_dir archive_dir

instead of 

   cp -Rp src_dir archive_dir

So, this whould be a minor improvement.

Code in attached file comes from FreeBSD.
Linux's 'cp -a' has the same semantics.

The following is a commit message from FreeBSD.

    Add an '-a' option which is identical to specifying '-RpP' for
    compatibility with other implementations.

It also makes sense to note in manual page that -P is the default

--- cp.1        26 Oct 2007 16:31:16 -0000      1.30
+++ cp.1        21 Dec 2010 06:00:36 -0000
@@ -106,6 +106,7 @@
 don't copy file flags.
 .It Fl P
 No symbolic links are followed.
+This is the default.
 .It Fl p
 Causes
 .Nm

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index