[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cp command
From: |
Bob Proulx |
Subject: |
Re: cp command |
Date: |
Fri, 28 Mar 2003 09:59:30 -0700 |
User-agent: |
Mutt/1.3.28i |
Chris Robinson wrote:
>
> I think the cp command behaves inconsistently.
Thanks for the nice description of the issue.
> Given the following directory structure....
>
> /tmp/a/b/c
> /tmp/x
>
> .... the following 2 commands from within /tmp should produce the same result
> in /tmp/x and /tmp/y
>
> cp -a a x
> cp -a a y
>
> ....but they don't. The result is:
>
> /tmp/x/a/b/c
> /tmp/y/b/c
>
> If the target directory exists the command copies the source directory
> itself and its contents into the target directory. If the target directory
> does not exist it is created but only the source directory's contents are
> copied.
Your description is correct. It depends upon if the target is a
directory or not. But so it has been for 30 years. It is too late to
change that type of behavior now. Not only cp but other commands such
as rsync, etc. use that same convention. If the target is a directory
then the result is placed into that directory.
Bob
- cp command, Chris Robinson, 2003/03/28
- Re: cp command,
Bob Proulx <=