Skip to content

Mstoic

  • Home
  • Start Here!
  • Best Deals
  • Facebook Tricks
  • Privacy
  • Resources
  • TOC
  • Tools
    • Web Tools
      • Stop Watch
      • QR Code Generator
      • Adsense Code Converter
      • Blogger Sitemap Generator
      • Difference Between Two Texts
      • Vacation Checklist
      • Twitter Symbols
      • Count Down
    • Investment
      • SIP Calculator
      • Power of Compounding
      • PPF Calculator
      • FD Calculator
  • About Us

Removing A Non Empty Directory In Ubuntu

Editorial Team | December 22, 2013 | Ubuntu |

Most of us using Ubuntu know that a directory can be easily deleted using the “rm” command, but this works only for empty directories. If you try the same command “rm folderName” with a folder containing files/folders, you will end up getting an error – “rm: failed to remove ‘folderName’: Directory not empty”. This is because the command only works for empty folders.

An addition of a simple “-r” can solve your problem. This command recursively checks and removes all the files and directories within the directory in question. The command below will remove a non empty directory in Ubuntu.

rm -r folderName

The above command will ask for your confirmation to delete the directory. If you are an expert user and you are absolutely sure that the directory you typed is the one you want to delete, then you can use the command given below instead. This will not ask for confirmation and will delete the directory straight-away.

rm -rf folderName

If you are a beginner and you want to confirm each and every file individually before deletion, then you should use the following command.

rm -r -i folderName

The command above is the safest one. It will keep you from accidentally deleting files you don’t intend to.

Previous Post

Installing Plugins On Wordpress

by Editorial Team

Next Post

Doing Complete SEO Of Your WordPress Website With Wordpress SEO By Yoast

by Editorial Team

Recommended Next
Installing And Using Unzip On Ubuntu

Your Comment Cancel reply

Follow Us

Like us Follow us Follow us

Categories

  • Tricks (93)
  • Facebook (83)
  • Tips (76)
  • Windows (67)
  • Wordpress (39)
  • Android (38)
  • Internet (33)
  • Antivirus (30)
  • How To (29)
  • Webmasters (25)
  • Customization (25)
  • Downloads (21)
  • Utilities (21)
  • Gmail (20)
  • Windows 7 (19)

Related Articles

  • Reverse a String using StringBuilder