49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
|
|
"""
|
||
|
|
Reset study - Delete results database and logs.
|
||
|
|
|
||
|
|
Usage:
|
||
|
|
python reset_study.py
|
||
|
|
python reset_study.py --confirm # Skip confirmation
|
||
|
|
"""
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
import shutil
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
import argparse
|
||
|
|
parser = argparse.ArgumentParser()
|
||
|
|
parser.add_argument('--confirm', action='store_true', help='Skip confirmation')
|
||
|
|
args = parser.parse_args()
|
||
|
|
|
||
|
|
study_dir = Path(__file__).parent
|
||
|
|
results_dir = study_dir / "2_results"
|
||
|
|
|
||
|
|
if not args.confirm:
|
||
|
|
print(f"This will delete all results in: {results_dir}")
|
||
|
|
response = input("Are you sure? (y/N): ")
|
||
|
|
if response.lower() != 'y':
|
||
|
|
print("Cancelled.")
|
||
|
|
return
|
||
|
|
|
||
|
|
# Delete database files
|
||
|
|
for f in results_dir.glob("*.db"):
|
||
|
|
f.unlink()
|
||
|
|
print(f"Deleted: {f.name}")
|
||
|
|
|
||
|
|
# Delete log files
|
||
|
|
for f in results_dir.glob("*.log"):
|
||
|
|
f.unlink()
|
||
|
|
print(f"Deleted: {f.name}")
|
||
|
|
|
||
|
|
# Delete JSON results
|
||
|
|
for f in results_dir.glob("*.json"):
|
||
|
|
f.unlink()
|
||
|
|
print(f"Deleted: {f.name}")
|
||
|
|
|
||
|
|
print("Study reset complete.")
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|