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
Best Answer
The problem is with your
find
invocation:If your PDF was named “Foo_20.pdf” then when
find
matched it it would attempt to runFoo_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 apermission denied
error.Your command is missing a
cp
invocation: