looking for command to remove directory and all below it:

Posted on 2009-02-20
Last Modified: 2013-12-26
looking a man for rm and rmdir and everytime I try to delete the directory with all below it it wont let me...? any way to do this.?
error message is Diretory not empty
i have also tried it with other shells ; bash
Question by:solunatec
    LVL 23

    Accepted Solution

    rm -rf directory
    Be careful, as with this command you won't be asked for anything - it will silently delete your directory and its content.
    LVL 23

    Expert Comment

    You may check what files are in this directory with "ls -a directory" command. Probably there are some 'hidden' files (hidden = with names starting with '.').
    LVL 48

    Expert Comment

    I'm surprised you managed to miss the following from the rm man page

         -R    Attempt to remove the file hierarchy rooted in each file argument.
               The -R option implies the -d option.  If the -i option is speci-
               fied, the user is prompted for confirmation before each directory's
               contents are processed (as well as before the attempt is made to
               remove the directory).  If the user does not respond affirmatively,
               the file hierarchy rooted in that directory is skipped.

         -r    Equivalent to -R.

    LVL 40

    Expert Comment

    first, is this a mount directory? is it a separate file system? you may run command below to see file systems and their mount directories.

    what command you ran to delete dir? did you try

    rm -rf dir

    Are you root or owner of this  dir?

    Author Comment

    sorry tintin I did not see your entry either before i gave the points out: i owe you 250
    LVL 48

    Expert Comment

    That's fine I don't need the points.  Did you find the man page description confusing?
    LVL 23

    Expert Comment

    solunatec: you can always click 'Request Attention' and ask moderators for changing your answer choice. I'm not going to object :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now