Answer the question
In order to leave comments, you need to log in
linux. How to copy the contents of one folder to another in the terminal without creating an extra subfolder in the second?
Example. The ~/test1/ folder contains the fld1 subfolder and the text.txt file. You need to copy them to the ~/test2/ folder, in which something already lies.
If ~/test2 does not exist, then cp -a ~/test1 ~/ test2 will work correctly, but in my case (when ~/test2/ already exists), a subfolder is created with the name of the original. That is, a copy of the text file will be located in ~/test2/test1/text.txt
[email protected] ~ $ ls tes*
test1:
fld1 text.txt
test2:
[email protected] ~ $ cp -a ~/test1/ ~/test2/
[email protected] ~ $ ls tes*
test1:
fld1 text.txt
test2:
test1
[email protected] ~ $ ls ~/test2/test1/
fld1 text.txt
C:\>xcopy c:\temp\test1 c:\temp\test2 /i /e
C:\Temp\test1\text.txt
Скопировано файлов: 1
C:\>dir C:\Temp\test2
Том в устройстве C имеет метку Локальный диск
Серийный номер тома: *******
Содержимое папки C:\Temp\test2
15.09.2014 15:24 <DIR> .
15.09.2014 15:24 <DIR> ..
15.09.2014 15:07 <DIR> fld
12.08.2014 18:12 877 text.txt
1 файл 877 байт
3 папки ***** байт свободно
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question