Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Having trouble copying and moving file ?!?! Help

Posted by: star21 Feb 25 2016, 02:52 PM

Been struggling for hours trying to figure this out and I'm getting frustrated. I needa know what i am doing wrong.
This is the tree i am working with. And the exercise goes as follows:

Your current directory is stenton. Make a copy of the file annex(in markham), called annex2, and place it in markham.


`-- sample_dir1
`-- sample_dir
|-- admin
|-- cambridge
| |-- cafeteria
| |-- library
| `-- security
| |-- annex
| |-- building
| `-- parking
|-- faculty
|-- history.exe
|-- markham
| |-- annex
| |-- building1
| `-- parking
|-- oxford
| |-- outline.doc
| |-- programming
| | `-- report.pdf
| `-- security
`-- stenton
|-- gen_ed
`-- lib_arts
|-- english.txt
`-- match.doc


Now i have tried everything from cp ../markham/annex annex2

mv /sample_dir1/sample_dir/markham/annex annex2

Now I think what i am missing is the part to move the copied file into the markham directory but I cant seem to figured out what I am missing.

Please help. really trying to figure this out as well as understand it.


Posted by: michaelk Feb 25 2016, 04:35 PM

I do not see anything in the question about moving files.

I assume this is an exercise on paths. .. is the parent which is one directory up the tree. . is the current working directory. A path starting with / is absolute and relative if it does not.

The syntax for cp is:
cp source destination

cp ../markham/annex annex2

If the destination does not have any path then it will be created in the current working directory. If the destination is supposed to be in the same directory as the source than what do you think the path/file should be?

Posted by: star21 Feb 25 2016, 09:50 PM

QUOTE (michaelk @ Feb 25 2016, 04:35 PM) *
I do not see anything in the question about moving files.

I assume this is an exercise on paths. .. is the parent which is one directory up the tree. . is the current working directory. A path starting with / is absolute and relative if it does not.

The syntax for cp is:
cp source destination

cp ../markham/annex annex2

If the destination does not have any path then it will be created in the current working directory. If the destination is supposed to be in the same directory as the source than what do you think the path/file should be?



well its saying to making a copy of the file and place the copy into the same directory which is markham. but since im not in that directory i cant figure out how to drop the copied file into the markham dir, in the path. tried many different combinations.

Posted by: michaelk Feb 26 2016, 07:25 AM

That is all done by the copy command.

I gave you a hint. Its the same.

Posted by: star21 Feb 26 2016, 10:35 AM

QUOTE (michaelk @ Feb 26 2016, 07:25 AM) *
That is all done by the copy command.

I gave you a hint. Its the same.



I finally figured it out!

cp ../markham/annex ../markham/annex2

Posted by: michaelk Feb 26 2016, 12:30 PM

Well done.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)