0

I have recently updated to Big Sur from Mojave (not willingly). I have tried to copy a bunch of pdfs in Terminal using the command:

find . -name "*_20*.pdf" -exec {} ~/Desktop/. \;

but it results in "permission denied". This command used to work before and indeed I can execute

cp my_fav_file_2010.pdf ~/Desktop

without a problem.

Terminal and iTerm are added to have "Full Disk Access" in the Privacy and Security Preferences. I even reached into /usr/bin and added find and zsh from /bin/ to the list, but it still gives me "permission denied". Any tips what is going on and how to fix this?

kJ

0

The problem is with your find invocation:

find . -name "*_20*.pdf" -exec {} ~/Desktop/. \;

If your PDF was named “Foo_20.pdf” then when find matched it it would attempt to run Foo_20.pdf ~/Desktop/. which is an attempt to execute the PDF as if it were an executable, and of course because it’s not (specifically, because it lacks the +x file permission) you get a permission denied error.

Your command is missing a cp invocation:

find . -name "*_20*.pdf" -exec cp {} ~/Desktop/. \;
1
  • 1
    Massive facepalm emoji :-) Thank you! – yotiao Feb 12 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .