# Große Ordner löschen (rm -rf)

### Mit `rm` (inklusive Fortschrittsanzeige und Log)

<div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950" id="bkmrk-rm--rf-%2Fpfad%2Fzum%2Ford"><div class="overflow-y-auto p-4" dir="ltr">  
</div></div>[https://unix.stackexchange.com/questions/255190/is-it-possible-to-determine-the-progress-of-an-rm-command](https://unix.stackexchange.com/questions/255190/is-it-possible-to-determine-the-progress-of-an-rm-command)

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](http://www.ivarch.com/programs/pv.shtml)

This is the command

```
rm -rv <em>DIR_OR_FILE_NAME</em> | pv -l -s $( du -a <em>DIR_OR_FILE_NAME</em> | wc -l ) > /dev/null
```

If you need root permissions for the dir or file to delete,

```
sudo rm -rv <em>DIR_OR_FILE_NAME</em> | pv -l -s $( sudo du -a <em>DIR_OR_FILE_NAME</em> | wc -l ) > /dev/null
```

- `rm -rv`: `-r` to recursively remove DIRs and files. `-v` verbose it lists all the files and directories that is removing.
- `pv -l -s`: `-l` to count lines instead of bytes. `-s` set the total lines to be removed.
- `$( du -a <dir_or_file> | wc -l )`: `du -a` returns a list all files and directories from the dir specified. `wc -l` returns the count of lines outputted by `du -a`.
- `> /dev/null`: send the output of `rm -rv` to nowhere.