Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 34935  / 2 Years ago, mon, april 25, 2022, 7:42:01

I am trying to understand linux and working through some tutorials. One states that I can copy files to the current directory by using a cp -a command with a relative pathname such as



cp -a ../somedir/.   


It fails each time I run it. Is the syntax incorrect?

I tried the man page, but it didn't seem to find anything that answers my question.


More From » files

 Answers
2

cp -a ../somedir/. is wrong. The general syntax is



cp source target


You only specified one argument. To copy something to current directory, you can run



cp ../somedir .


Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.


[#5757] Wednesday, April 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rvousnove

Total Points: 456
Total Questions: 130
Total Answers: 98

Location: El Salvador
Member since Sun, Sep 12, 2021
3 Years ago
;