Primal Habits
It is currently Sun Mar 26, 2017 12:51 pm


Feed

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Aug 19, 2011 12:11 am 
Offline
User avatar

Joined: Sun Apr 25, 2010 1:02 pm
Posts: 115



How to remove a directory without deleting each file Linux

Start by switching User to root (su - root), & then give the following command.

rmdir --ignore-fail-on-non-empty <directoryname>

Keep in mind <directoryname> is the name of the directory you wish to have removed.

You could also try.....
rm -dR <directoryname> (-d will only for the server root user)

-d remove the directory even if it isn't empty (server root user)
-R recursive drill down throughout the entire directory.

A slightly shorter command....
rm -rf /file-to-delete

Attention!!
Be extremly careful when you are root user with rm command
Example:
rm -fr / file-to-delete

Pay special attention to the accidental space between / and file-to-delete (*The shell will interpret this command as "remove the root directory ( / )*)

WARNING!!
If you accidentally perform this command, *your entire filesystem will be deleted*.

_________________
Check Out RouterHead8080 T.V.



Share on FacebookShare on TwitterShare on TuentiShare on SonicoShare on FriendFeedShare on OrkutShare on DiggShare on MySpaceShare on DeliciousShare on Technorati
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 7 hours [ DST ]


Related topics
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. MySQL config file location - Redhat Linux Centos Server

RouterHead8080

0

18328

Sun Apr 21, 2013 10:05 pm

RouterHead8080 View the latest post

There are no new unread posts for this topic. AVG Free Antivirus File Download

RouterHead8080

0

1267

Mon Dec 12, 2011 12:05 pm

RouterHead8080 View the latest post

There are no new unread posts for this topic. Joomla 1.6 - 1.5 - Remove border around login module.

RouterHead8080

0

2568

Thu Apr 28, 2011 2:03 pm

RouterHead8080 View the latest post

There are no new unread posts for this topic. Wordpress Replace/Remove Default Header Image Twenty Eleven

RouterHead8080

0

1062

Tue Nov 22, 2011 11:09 am

RouterHead8080 View the latest post

There are no new unread posts for this topic. How to list all your Users in Linux

RouterHead8080

0

1203

Thu Aug 18, 2011 11:52 pm

RouterHead8080 View the latest post

 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron

Affiliates    Terms of use    Privacy policy   

Primal Habits, a Sceptersoft Company
Copyright © 2010 - 2017 Sceptersoft LLC. All rights reserved.