Skip to content

Instantly share code, notes, and snippets.

@jeremywrnr
Last active August 29, 2015 14:07
Show Gist options
  • Save jeremywrnr/5ba6015a2012ec3ee661 to your computer and use it in GitHub Desktop.
Save jeremywrnr/5ba6015a2012ec3ee661 to your computer and use it in GitHub Desktop.
convenient (and more visually appealing) alternative to [ rm -rf (dirname); rmdir (dirname) ]
#!/usr/bin/env sh
for arg; do
# ptint out folder structure to remove
printf "\n Folder to remove: $arg\n\n"
tree "$arg"
printf "\n[y/n] Remove folder? "
read CONTINUE
# parse input and delete folder
if [ "$CONTINUE" = "y" ]; then
printf "\nRemoving $arg now...\n\n"
rm -vrf "$arg"
# rmdir -p "$arg"
printf "\nOperations completed.\n\n"
else
printf "\nFolder $arg not deleted.\n\n"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment