How to remove all the .pyc files recursively from a certain directory including sub-directories? I tried
$rm -f *.pycThis seems to work for only the current directory, but not the directories following it. Please help me..
3 Answers
You can use
cd <your_directory>
find . -name "*.pyc" -exec rm -rf {} \;This will remove all the *.pyc files from your current directory and its sub directory
3Use find:
find /some/directory -type f - name "*.pyc" -exec rm -f {} \;or, if your find has the -delete option:
find /some/directory -type f - name "*.pyc" -delete find /var/www/html -name "*.pyc" -delete 1