LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cp --parents /d1/.d2/d3/foo.txt /e1/ breaks the path at 1st '.', even with -a. (https://www.linuxquestions.org/questions/linux-newbie-8/cp-parents-d1-d2-d3-foo-txt-e1-breaks-the-path-at-1st-even-with-a-886196/)

stf92 06-14-2011 02:40 AM

cp --parents /d1/.d2/d3/foo.txt /e1/ breaks the path at 1st '.', even with -a.
 
kernel 2.6.21.5
cp (GNU coreutils) 6.9.

Hi:

Code:

bash-3.1$ mkdir e1
bash-3.1$ cp --parents d1/.d2/foo.txt e1
bash-3.1$ ls -R e1
e1:
d1

e1/d1:
bash-3.1$

What I would like the result to be is
Code:

bash-3.1$ ls -R e1
e1:
d1

e1/d1:
.d2

e1/d1/.d2:
foo.txt
bash-3.1$

Any other cp options to remedy the situation? Thanks.

colucix 06-14-2011 04:38 AM

You need the -a option of ls to see hidden files and directories:
Code:

bash-3.1$ ls -aR e1
e1:
. .. d1

e1/d1:
. .. .d2

e1/d1/.d2:
. .. foo.txt

The file has been copied together with its parent directories, but you cannot see it without ls -a.

stf92 06-14-2011 04:54 AM

You must excuse my clumsyness. I think it's bedtime for me already. Thanks a lot.


All times are GMT -5. The time now is 02:59 AM.