0

I am just starting out but I am running into issues copying different files. Ultimately I am trying to copy file3.txt to the desktop. I started off by creating a directory and the file3.txt.

cd Desktop

mkdir Classes

mkdir Classes/NOS110

mkdir Classes/NOS110/Handouts

mkdir Classes/NOS110/Handouts/file3.txt

cd (to get back to home directory)

ls -a Desktop/Classes/NOS110 (to list the contents of the NOS110 directory)

cp file3.txt Desktop (it keeps saying it does not exist)
I've tried different ways to get it to copy over and im stuck what I have tried in the picture

sinecode
  • 205
j doe
  • 1

2 Answers2

2

You must give an unambiguous path to the file - otherwise the system can only assume that it's in the current directory.

Since you used cd to return to your home directory, that would be

cp -r Desktop/Classes/NOS110/Handouts/file3.txt Desktop/

The -r is necessary since despite its name, file3.txt is a directory (you created it using mkdir - perhaps you should have used touch?)

steeldriver
  • 136,215
  • 21
  • 243
  • 336
0

Try this (Edit : When you are in the directory which the folder which the file is in) :

cp file3.txt ~/Desktop