1

I am trying to find files with read permissions from root directory and save them under /home/student/abc direcory:

find / -type f -perm a+r -exec cp /home/student/abc {} + 

but it shows me the error:

enter image description here

enter image description here

2

Try this, fixes the cp parameter order and limits to just root filesystem rather than trying to traverse /proc and the like.

find / -xdev -type f -perm a+r -exec cp {} /home/student/abc \;
1

From cp man page:

cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...

You are giving parameters to cp in wrong order. Source should come before destination. Correct command is :

find / -type f -perm a+r -exec cp {} /home/student/abc \; 

Also note that you should end -exec parameter with ;

  • I tried but it did not work and I attached a new picture there – Invoker Jul 1 '15 at 0:09
  • If you want to see what is being done, you should use cp with -v parameter – Esref Jul 1 '15 at 0:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.