diff options
author | Rasmus <rasmus.luha@gmail.com> | 2023-04-08 00:27:03 +0300 |
---|---|---|
committer | Rasmus <rasmus.luha@gmail.com> | 2023-04-08 00:27:03 +0300 |
commit | a16bdfe930d89e1a7fb354b78d16e8742118f76d (patch) | |
tree | f32aabd929a485ac24ea2b3fb1c9c9d041f27478 /local/.local/scripts/rmshit |
checkers
Diffstat (limited to 'local/.local/scripts/rmshit')
-rwxr-xr-x | local/.local/scripts/rmshit | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/local/.local/scripts/rmshit b/local/.local/scripts/rmshit new file mode 100755 index 0000000..2e166a9 --- /dev/null +++ b/local/.local/scripts/rmshit @@ -0,0 +1,106 @@ +#! /usr/bin/env python3 + +# https://github.com/lahwaacz/Scripts/blob/master/rmshit.py + +import os +import sys +import shutil + + +shittyfiles = [ + '~/.adobe', # Flash crap + '~/.macromedia', # Flash crap + '~/.recently-used', + '~/.local/share/recently-used.xbel', + '~/Desktop', # Firefox creates this + '~/.thumbnails', + '~/.gconfd', + '~/.gconf', + '~/.local/share/gegl-0.2', + '~/.FRD/log/app.log', # FRD + '~/.FRD/links.txt', # FRD + '~/.objectdb', # FRD + '~/.gstreamer-0.10', + '~/.pulse', + '~/.esd_auth', + '~/.config/enchant', + '~/.spicec', # contains only log file; unconfigurable + '~/.dropbox-dist', + '~/.parallel', + '~/.dbus', + '~/ca2', # WTF? + '~/ca2~', # WTF? + '~/.distlib/', # contains another empty dir, don't know which software creates it + '~/.bazaar/', # bzr insists on creating files holding default values + '~/.bzr.log', + '~/.nv/', + '~/.viminfo', # configured to be moved to ~/.cache/vim/viminfo, but it is still sometimes created... + '~/.npm/', # npm cache + '~/.java/', + '~/.swt/', + '~/.oracle_jre_usage/', + '~/.jssc/', + '~/.tox/', # cache directory for tox + '~/.pylint.d/', + '~/.qute_test/', + '~/.QtWebEngineProcess/', + '~/.qutebrowser/', # created empty, only with webengine backend + '~/.asy/', + '~/.cmake/', + '~/.gnome/', + '~/unison.log', + '~/.texlive/', + '~/.w3m/', + '~/.subversion/', + '~/nvvp_workspace/', # created empty even when the path is set differently in nvvp + '~/.ansible/', + '~/.fltk/', + '~/.vnc/', + #'~/.mozilla/', gotta have for firefox, otherwise settings arent save, but + # You should go Brave or sth anyways my dude. +] + + +def yesno(question, default="n"): + """ Asks the user for YES or NO, always case insensitive. + Returns True for YES and False for NO. + """ + prompt = "%s (y/[n]) " % question + + ans = input(prompt).strip().lower() + + if not ans: + ans = default + + if ans == "y": + return True + return False + + +def rmshit(): + print("Found shittyfiles:") + found = [] + for f in shittyfiles: + absf = os.path.expanduser(f) + if os.path.exists(absf): + found.append(absf) + print(" %s" % f) + + if len(found) == 0: + print("No shitty files found :)") + return + + if yesno("Remove all?", default="n"): + for f in found: + if os.path.isfile(f): + os.remove(f) + else: + shutil.rmtree(f) + print("All cleaned") + else: + print("No file removed") + + +if __name__ == '__main__': + rmshit() + |