Using the command line in Ubuntu 16.04.2 LTS. I'm getting towards the end of Zed Shaw's LPTHW, and on the video to ex46.py he exercises the following bash command to find and remove all .pyc byte code files:
find . -name "*.pyc" -exec rm {}
On the video this successfully removes all of Zed Shaw's .pyc files. However, upon typing in the exact same command I get the following error:
find: missing argument to `-exec'
I understand that there are many ways to delete .pyc files, however, since I'm following along with Zed Shaw I'd like to know how to do it using find and -exec. What am I doing wrong?
You could leverage using -delete
over -exec rm
as the former does not spawn a new process for each of the file instance to delete. Also you could chip in the -type f
option to apply the operation for files only.
find . -type f -name "*.pyc" -delete