Cleanup your messy backup by hand could be fun! Kinda of. The goal is to remove duplicated files and organize the files into a new structure.
First of all lets record the free disk space over time.
Consider this script which collects the free space over time in a file:
$ cat freespace.sh date | tr '\n' ' ' | tee -a freespace_overtime df -h . | tail -n 1 | tee -a freespace_overtime $ cat freespace_overtime Sun 09 Apr 2023 08:24:59 AM CEST /dev/sdb1 1008G 779G 178G 82% /mnt
Now lets try to find some things like local Qt and boost installations, check the downloads/ and opt/ folders, .Trash/ .wine build/ .hg .svg git .local .cache .mozilla .dropbox java .steam bin/ , linux- kernel source, other obsolete downloads and delete them. Also check for hidden directories and hidden files...
Local Qt installation are usually in the folder "QtSDK" or "Qt-*". The -prune option tell find to stop the recursion when find a matching folder.
find . -type d -iname "QtSDK*" -prune ./backup/kater_12.01.2018/kater/QtSDK find . -type d -iname "Qt-*" -prune ./backup/kater_12.01.2018/kater/Qt-1.6.0
find . -type d -iname "*.java*" -prune
6GB good start
Find boost installations
$ find . -type d -iname "boost*" -prune ./backup/kater_12.01.2018/kater/download/boost_1_64_0
Almost 1GB for me.
Usually there is a lot of stuff in the downloads folder which can be removed
$ find . -type d -iname "*download*" -prune
Cleaned up 14GB!
More obsolete stuff in opt/ folders.
find . -type d -iname "opt" -prune
Only 1GB this time.
Find trash bins.
find . -type d -iname "*trash*" ./.Trash-1000 ./backup/backup_80GB_HDD/backup_festrechner_13.03.2012/kater/.local/share/Trash
5GB Trash... Be aware don't delete your regular backup files. Because there is no other backup ;)
Old wine folders can be interesting. ...
find . -type d -iname ".wine" -prune
But not this time.
Finding old build folders result in a lot of false positives.
$ find . -type d -iname "*build*" -prune
2GB for me.
Old Mercurial hidden folders. Delete them all!
$ find . -type d -iname ".hg" -prune
And old subversion folders too. Gosch I have over 200 of them
find . -type d -iname ".svn" -prune | xargs rm -fr
Don't forget to delete the git folders too! They should be in the cloud anyway ;)
find . -type d -iname ".git" -prune
Wow 11GB. Guess I deleted some other things too XD
Nicht wirklich was zu holen bei .local.
find . -type d -iname ".local" -prune
Immerhin 1GB bei .cache
find . -type d -iname ".cache" -prune
Nur 700MB. Weg damit. Wenn da was wichtiges gespeichert wäre, hätte man es an anderer Stelle nochmal gespeichert.
find . -type d -iname ".mozilla" -prune
Dropbox haha als sich "Cloud" anfing durchzusetzen.
find . -type d -iname "*dropbox*" -prune
Haha Java weine ich keiner Träne nach
find . -type d -iname "*.java*" -prune
Mit Steam ist das eigentlich so eine Sache, aber auf der anderen Seite kann man alles neu runterladen. Man hat es ja gekauft...
find . -type d -iname "*.steam" -prune
1.3GB!
Unglaublich was sich so alles in bin/ Ordner versteckt.
find . -type d -iname "bin" -prune
Immerhin 6GB.
Versteckte Ordner sind ja auch so einen Sache von denen man nichts weiß und ergo auch nicht braucht.
$ find /mnt -type d -iname ".*" -prune
Das waren auch ein paar GB...
Und versteckte Dateien erst. Was sich da an Müll ansammelt
$ find /mnt -type f -iname ".*" -prune
Diese dummen autoerstellen thumbnail Dateien können auch weg.
find . -iname "thumbs.db" -print0 | xargs -0 du -ch
Nur 40MB aber Müll ist Müll.
Beim erstellen von Half Life Maps entstanden früher jeden Menge Mülldatein beim compilieren. Diese haben die Endung p0 p1 p2 p3 prt pts wic lin max und können nach kurzer Sichtung alle gelöscht werden.
find . -iname "*.p0" -print0 | xargs -0 du -ch find . -iname "*.p1" -print0 | xargs -0 du -ch find . -iname "*.p2" -print0 | xargs -0 du -ch find . -iname "*.p3" -print0 | xargs -0 du -ch find . -iname "*.prt" -print0 | xargs -0 du -ch find . -iname "*.pts" -print0 | xargs -0 du -ch find . -iname "*.wic" -print0 | xargs -0 du -ch find . -iname "*.lin" -print0 | xargs -0 du -ch find . -iname "*.max" -print0 | xargs -0 du -ch
Bei den .prt Datein hat sich _EINE_ Datei aus NFSp reingemogelt die nicht gelöscht werden sollte.
Kanpp 1k Datei und 62M.