This commit is contained in:
2025-05-25 10:31:22 +02:00
parent 1caeb8fc98
commit 225e33056a
102 changed files with 8390 additions and 0 deletions

27
clear_specific_files.py Normal file
View File

@@ -0,0 +1,27 @@
from app import create_app, db
from app.models import RoomFile, Room
import os
app = create_app()
with app.app_context():
# Get the Test room
room = Room.query.filter_by(name='Test').first()
if not room:
print("Test room not found")
exit(1)
# Delete from database
files = ['Screenshot_2025-03-19_100338.png', 'Screenshot_2025-03-19_100419.png']
deleted = RoomFile.query.filter_by(room_id=room.id, name__in=files).delete()
db.session.commit()
print(f"Deleted {deleted} records from database")
# Delete from filesystem
room_path = os.path.join('data', 'rooms', str(room.id))
for file in files:
file_path = os.path.join(room_path, file)
if os.path.exists(file_path):
os.remove(file_path)
print(f"Deleted file: {file_path}")
else:
print(f"File not found: {file_path}")