Große Ordner löschen (rm -rf)
Mit rm (inklusive Fortschrittsanzeige und Log)
rm -rf: Löscht rekursiv und ohne Rückfragen.2>&1: Leitet Fehler- und Standardausgabe zusammen.tee -a delete.log: Zeigt den Vorgang an und schreibt ihn gleichzeitig in eine Logdatei.
Ordner samt Inhalt löschen:
rm -rf /pfad/zum/ordner 2>&1 | tee -a delete.lognur Inhalt löschen:
rm -rf /pfad/zum/ordner/* 2>&1 | tee -a delete.logEDIT: Klappt nicht so recht mit den logs..neue Methode:
I get the progress bar using pv command line Pipe Viewer
This is the command
rm -rv DIR_OR_FILE_NAME | pv -l -s $( du -a DIR_OR_FILE_NAME | wc -l ) > /dev/null
If you need root permissions for the dir or file to delete,
sudo rm -rv DIR_OR_FILE_NAME | pv -l -s $( sudo du -a DIR_OR_FILE_NAME | wc -l ) > /dev/null
-
rm -rv:-rto recursively remove DIRs and files.-vverbose it lists all the files and directories that is removing. -
pv -l -s:-lto count lines instead of bytes.-sset the total lines to be removed. -
$( du -a <dir_or_file> | wc -l ):du -areturns a list all files and directories from the dir specified.wc -lreturns the count of lines outputted bydu -a. -
> /dev/null: send the output ofrm -rvto nowhere.