I'm trying to delete all migration files in my Django app using a single command. Here's the structure of my repository:
|-- core
| |-- migrations
| |-- __init__.py
| |-- 0001_initial.py
| |-- 0002_add_column1.py
| |-- 0003_add_column1.py
|
|-- users
|-- migrations
|-- __init__.py
|-- 0001_initial.py
|-- 0002_add_column2.py
My goal is to delete all files besides __init__.py
so the repo looks like this:
|-- core
| |-- migrations
| |-- __init__.py
|
|-- users
|-- migrations
|-- __init__.py
I've tried the following command but no luck:
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
Try this, but change 'ROOT' to your root folder name:
find . -path "./ROOT/*/migrations/*.py" -not -name "__init__.py" -delete