🚧 find-junk: reformat
This commit is contained in:
parent
b69b268933
commit
132efe16e1
1 changed files with 16 additions and 9 deletions
25
find-junk
25
find-junk
|
@ -8,19 +8,26 @@ import os
|
|||
import os.path
|
||||
import sys
|
||||
|
||||
M = 1024*1024
|
||||
M = 1024 * 1024
|
||||
|
||||
|
||||
def junk_dirs():
|
||||
"""Return directories which potentially contain junk"""
|
||||
|
||||
for d in ['~/tmp', '~/.local/share/Trash', '~/rpmbuild', '~/RPM',
|
||||
'~/.cache/tracker', '~/.local/share/apt-dater/history']:
|
||||
static_junk_dirs = [
|
||||
"~/tmp",
|
||||
"~/.local/share/Trash",
|
||||
"~/rpmbuild",
|
||||
"~/RPM",
|
||||
"~/.cache/tracker",
|
||||
"~/.local/share/apt-dater/history",
|
||||
]
|
||||
for d in static_junk_dirs:
|
||||
d = os.path.expanduser(d)
|
||||
if os.path.exists(d):
|
||||
yield d
|
||||
for d, _, _ in os.walk(os.path.expanduser('~')):
|
||||
if d.endswith('.sync/Archive'):
|
||||
for d, _, _ in os.walk(os.path.expanduser("~")):
|
||||
if d.endswith(".sync/Archive"):
|
||||
yield d
|
||||
|
||||
|
||||
|
@ -49,17 +56,17 @@ def main():
|
|||
if os.path.isdir(d):
|
||||
du_d = du(d)
|
||||
|
||||
if du_d < 5*M:
|
||||
if du_d < 5 * M:
|
||||
continue
|
||||
|
||||
if du_d > 100*M:
|
||||
if du_d > 100 * M:
|
||||
fore = Fore.RED
|
||||
elif du_d > 50*M:
|
||||
elif du_d > 50 * M:
|
||||
fore = Fore.YELLOW
|
||||
else:
|
||||
fore = Fore.RESET
|
||||
|
||||
print(fore + str(du_d//M) + 'M\t' + d + Fore.RESET)
|
||||
print(fore + str(du_d // M) + "M\t" + d + Fore.RESET)
|
||||
|
||||
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue