@raspberriesareyummy@lemmy.world
2026-11-14 10:48 UTC
mv folder delete-this rm -rf delete-this
gives you one chance to reconsider what you just did before it is too late. And you never have a risk of a dangerous delete-all lurking in your command history.
Replies (1)
-
@thingsiplay@lemmy.ml 2026-11-15 18:03
Or rm -rf dir instead a relative path. Write down the actual path or directory name you want to delete. Do not use only variables for the path. But combining with literals is fine, such as dir/${subdir}/* . One can also test if the directory exists before starting the process, especially useful in scripts. And I recommend using –verbose option to see what is being deleted: test -d dir && rm -rfv dir