43 lines
1.0 KiB
Plaintext
Raw Normal View History

2025-01-14 17:53:15 +00:00
#!/usr/bin/env python3
import pathlib
import sys
delete_files = "--delete" in sys.argv
exclude_files = ["Makefile", ".gitignore", ".bzrignore", "clean",".clang-format",".clang-tidy"]
source_extensions = [".bak", ".tar",".c",".h",".cpp",".hpp",".md",".rzip",".gif"]
files_ignored = []
files_pending = []
file_count = 0
for f in pathlib.Path(".").glob("*"):
if f.is_dir():
files_ignored.append(f)
continue
if f.name in exclude_files:
files_ignored.append(f)
continue
if f.suffix not in source_extensions:
file_count += 1
files_pending.append(f)
if delete_files:
f.unlink();
print("{} - DELETED".format(str(f)))
if not delete_files:
print("IGNORED:")
for f in files_ignored:
print(" - {}".format(str(f)))
print("PENDING DELETION:")
for f in files_pending:
print(" - {}".format(str(f)))
print("{} files.".format(file_count))
if not delete_files:
print("\n* Add --delete to remove files listed above.")