I would like a bash and tcsh alias for rm that does:
- uses the FILE list from rm command to calculate the size of the files to be deleted
- asks the user if they really want to delete that much data
- if yes, then execute the rm command. if no, then exit.
e.g. suppose 'du -shc data/* | tail -1' return "56 GB total":
$ rm -rf data/*
Are you sure you want to delete 56 GB total? (y/n) n
Nothing deleted
$ rm -rf data/*
Are you sure you want to delete 56 GB total? (y/n) y
executing rm -rf data/*
$
Aucun commentaire:
Enregistrer un commentaire