Glam Prestige Journal

Bright entertainment trends with youth appeal.

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.

2

2 Answers

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.

1

You can say:

cp -a ../somedir .if you want to copy the folder it self with its content

Or you can say

cp -a ../somedir/* . If you want to copy the content of the folder.

the -a option will try to clone the same file structure with the same file tree to the new location

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy