Große Ordner löschen (rm -rf)
Mit rm (inklusive Fortschrittsanzeige und Log)
Eikes Variante, um nur den Inhalt zu löschen und nicht den Ordner selbst (/* am Ende des Pfades hinter den Anführungszeichen):
rm -rfv "/ordner/mit/leerzeichen dazwischen/testordner"/* | pv -l -s $( du -a "/ordner/mit/leerzeichen dazwischen/testordner"/* | wc -l ) > /dev/null
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.
No Comments