We help IT Professionals succeed at work.

linux remove directory

681 Views
Last Modified: 2014-09-01
on the command line, I am using rm -Rf directoryname and the directory will not remove, says they are not empty.  Does anyone know another way to remove this?
Comment
Watch Question

Kent WSr. Network / Systems Admin
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Gerwin JansenTopic Advisor
CERTIFIED EXPERT
Most Valuable Expert 2016
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2013
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
the error message is:  

Unable to remove directory dirname:  Directory is not empty
Kent WSr. Network / Systems Admin
CERTIFIED EXPERT

Commented:
If you are root, or using su, then there is something other than "regular" files / directories in your target directory.
Look for immutable files, links, mounts, etc. You may have to cd down and remove some directories one at a time until you find the culprit.  Make sure to do an ls -a so you can see hidden files while searching.
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
1. go  into directory
2. #ls -lah
3. remove if any hidden directory is there
4. check #df -h to see whether it is being used as mount point for any FS.
5. delete if by using #rm -rf /path/to/dir

TY/SA
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.