LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-11-2005, 10:24 PM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
Removing non-empty directory


Hi folks,

I was trying to remove '/sources/glibc-build' and '/sources/glibc-2.3.4-20040701', both non-empty with following steps without success


1) on LFS after chroot
Code:
root:/# rmdir -p --ignore-fail-on-non-empty ./sources/glibc-build/
root:/# rmdir -p --ignore-fail-on-non-empty ./sources/glibc-2.3.4-20040701/
root:/# ls -a ./sources/ | grep glibc-build
glibc-build
root:/# ls -a ./sources/ | grep glibc-2.3.4-20040701
glibc-2.3.4-20040701
glibc-2.3.4-20040701.tar.bz2
root:/# rmdir -p --ignore-fail-on-non-empty ./sources/glibc-build
root:/# ls -a ./sources/ | grep glibc-build
glibc-build

root:/# rmdir -pv --ignore-fail-on-non-empty ./sources/glibc-build
rmdir: removing directory, ./sources/glibc-build
root:/# ls -a ./sources/ | grep glibc-build
glibc-build
root:/# rmdir -pv --ignore-fail-on-non-empty ./sources/glibc-2.3.4-20040701
rmdir: removing directory, ./sources/glibc-2.3.4-20040701
root:/# ls -a ./sources/ | grep glibc-2.3.4-20040701
glibc-2.3.4-20040701
glibc-2.3.4-20040701.tar.bz2
They are still there.

2) Login as 'su -' on FC3 host
Code:
[satimis@localhost ~]$ su -
Password:
[root@localhost ~]# rmdir -pv --ignore-fail-on-non-empty /mnt/lfs/sources/glibc-build
rmdir: removing directory, /mnt/lfs/sources/glibc-build
[root@localhost ~]# ls /mnt/lfs/sources/glibc-build/
still showing them there.


Finally starting Konqueror as root on Konsole, I can remove them on Konqueror.

Please advise what was the trick behind.

TIA

B.R.
satimis
 
Old 07-11-2005, 10:35 PM   #2
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
try

rm -rf <directory name path etc>

use this with caution do not end up deleting all files on ur root

regards
 
1 members found this post helpful.
Old 07-11-2005, 11:43 PM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi masand,

Tks for your advice.

Quote:
rm -rf <directory name path etc>
Quote:
rm -rf /path/to/directory
Noted with thanks.

In my personal opinion it will be more safe to remove them on 'Konqueror'.

B.R.
satimis
 
1 members found this post helpful.
Old 07-12-2005, 03:40 AM   #4
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
well u should know about some more options
so that we u work on remote systems u are not stuck anywhere

regards
 
Old 03-05-2009, 01:19 AM   #5
amitshah.in
LQ Newbie
 
Registered: Mar 2009
Location: Ahmedabad
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by masand View Post
try

rm -rf <directory name path etc>

use this with caution do not end up deleting all files on ur root

regards
Hi Masand,

Thanks for you post. I'm trying to remove not empty directory and your post has provide me good help.
 
Old 03-09-2009, 04:58 AM   #6
zzypty
LQ Newbie
 
Registered: Mar 2009
Posts: 13

Rep: Reputation: 3
Removing non-empty directories

Hey,

The best way to remove a directory is
Quote:
$ rm -r <path_to_directory>/<name_of_directory>
For eg, if I have a directory in my /mnt/lfs directory called foobar, then the command will be
Quote:
rm -r /mnt/lfs/foobar
The -r option is for 'recursive'. The 'rm' command recursively removes all the files from the folder and then the folder itself.

Please be very careful when deleting files as root. Please ensure that the path to the directory is correct. A wrong path might delete some important files off your computer.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rm: cannot remove directory `ff': Directory not empty blancs Linux - General 17 08-29-2011 01:47 PM
Removing non empty directiories tolstyi Linux - Newbie 4 11-16-2004 11:23 AM
How do you remove a non empty directory aaronruss Linux - Newbie 3 06-05-2004 08:26 PM
Removing non-empty directories brunnopessoa Linux - Newbie 8 11-13-2003 07:56 PM
Mounting a non-empty directory MasterBean Linux - General 1 07-12-2001 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration