Created
November 19, 2022 14:02
-
-
Save 2gn/06bbd37ef834ac48db7faf2fd2935054 to your computer and use it in GitHub Desktop.
clean-up your abandoned projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import getoutput, run | |
directory_structure = getoutput(["ls", "-l"]).splitlines() | |
items_to_be_removed = [] | |
for file_or_directory in directory_structure: | |
if file_or_directory != "cleanup.py": | |
yesOrNo = input("Do you need this (y/n) : "+file_or_directory) | |
if yesOrNo == "n": | |
items_to_be_removed.append(file_or_directory) | |
print(items_to_be_removed) | |
if input("the items above will be removed. continue? (y/n) ") == "n": | |
raise SystemExit | |
for item in items_to_be_removed: | |
print("removing", item) | |
run(["rm", "-rf", item]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment