I would like to cp the whole directory, however inside that directory, it has some files which I don't permission to cp over. Is there any flag I can use in this case. Or are there any other command I should consider ? I think there should be a smart way to do this, like combine other commands Any help is appreciated.

For example,

text1.txt text2.txt *text3 text4.txt* text5.txt

text3 is another directory, and text4 is a file. While both of them, I don't have permission to access or view for now.

but the rest of files (or directory) I have the permission to cp over. How can we cp the only files with permission?

  • Just ignore all the errors is fine – daisy Mar 27 '17 at 7:41
  • @daisy , Thank you. It works for the problem i try to solve. – Maxfield Mar 27 '17 at 19:08

This seems simple, unless you're not providing all the information about what you're trying to achieve. Simply do


If you wanted to make it more complex, or if it's necessary (for some reason), you could do

find /some/directory/ -name '*text*' -user myusername -exec cp {} /some/other/directory/ \;
| improve this answer | |
  • . Thank you. but I think your overkilled it. something to learn. – Maxfield Mar 27 '17 at 19:10

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.