18

I've faced a problem when copying a file with the commands,

cp ~/Downloads/sample.pdf ~/Desktop/

But the terminal gives me a message, cp: cannot stat 'sample.pdf': No such file or directory.

qbi
  • 18,879
  • 9
  • 79
  • 127
Herks
  • 833
  • 2
  • 11
  • 19
  • What is the output of `ls -al` when you run it from ~/Downloads? You'll see the error you're seeing if there isn't a file of the **exact same name** present to be copied. –  Feb 22 '13 at 18:20

2 Answers2

11

Have you verified that sample.pdf is the exact filename in the downloads folder? It looks like the path is incorrect and that file doesn't actually exist there. Try this...

ll ~/Downloads

See if sample.pdf shows up in the file list.

Ben
  • 1,016
  • 2
  • 12
  • 14
2

If the file exists you have maybe not the correct permissions zu copy the file. Run in a terminal: sudo chmod 775 /home/<user>/Downloads/sample.pdf to grant yourself the permissions and sudo chown <your-user>:<your-user-group> /home/<user>/Downloads/sample.pdf to own the file and try to copy it again. Your user-group shoul be the same value as your user.

prophecy201
  • 2,690
  • 15
  • 21