Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove all .pyc files from a project?

Tags:

bash

I've renamed some files in a fairly large project and want to remove the .pyc files they've left behind. I tried the bash script:

 rm -r *.pyc 

But that doesn't recurse through the folders as I thought it would. What am I doing wrong?

like image 694
Teifion Avatar asked Apr 24 '09 11:04

Teifion


People also ask

Where are .PYC stored?

pyc files are placed in the same directory as the . py file. In Python 3.2, the compiled files are placed in a __pycache__ subdirectory, and are named differently depending on which Python interpreter created them. (This can be useful to people importing the same Python modules from multiple versions of Python.)

Are .PYC files needed?

pyc file is generated, there is no need of *. py file, unless you edit it.


1 Answers

find . -name "*.pyc" -exec rm -f {} \; 
like image 174
Bill the Lizard Avatar answered Sep 17 '22 12:09

Bill the Lizard