How to avoid being asked at each level if I want to delete that path? I just want to remove everything in a path?


You could use -I switch if you want to be prompted only once:

rm -rI sampledir/

from man rm:

-I     prompt once before removing more than three files, or when removing recursively.
       Less intrusive than -i, while still giving protection against most mistake

and use -f for "no prompt":

-f, --force
       ignore nonexistent files and arguments, never prompt


rm -rf sampledir/
  • had to use -f for no prompt – jdl Jun 24 '13 at 1:02
  • @jdl - Yes, -f is for no prompt, I misunderstood your question. – don_crissti Jun 24 '13 at 1:04
  • If I use the -I switch, it will ask "remove all arguments recursively"? Is there a way to customize this message including the foldername / directory path intending to remove? – Master of Celebration Nov 7 '13 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.