nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

auto deleting folders if empty

This is a discussion on auto deleting folders if empty within the Shell scripting forums, part of the Development/Scripting category; want to auto delete folder if its empty.... in order to do file system maintenance....to get rid of unused folders.....


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 09-06-2005, 08:47 PM
hinix
Guest
 
Posts: n/a
Default auto deleting folders if empty

want to auto delete folder if its empty.... in order to do file system maintenance....to get rid of unused folders..
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-06-2005, 11:58 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Use rmdir as follows:
Code:
rmdir --ignore-fail-on-non-empty {DIR-NAME}
It ignore each failure that is solely because a directory is non-empty
Reply With Quote
  #3 (permalink)  
Old 09-08-2005, 01:21 PM
hinix
Guest
 
Posts: n/a
Default

gr8...thanks monk,
sorry i didn't mention, that i am working on solaris 9.0, anyway ur suggestion was enogh to give me a hint and, this is what is working for me,

rmdir -ps {DIR-NAME}
Reply With Quote
  #4 (permalink)  
Old 09-08-2005, 06:02 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Hmm that's why you need to post it in solaris and not in shell scripting section
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
How can i create script for deleting user? Paul Shell scripting 1 08-02-2007 11:20 PM
How to archive files along with folders using TAR? Charlie82 Shell scripting 1 07-31-2007 06:26 AM
Linux delete empty directories raj Getting started tutorials 0 05-05-2007 02:29 AM
Public Folders In Scalix zafar466 Mail Servers 0 02-08-2007 01:52 PM
Announcements sections is empty!!! monk Feedback & Site News 2 02-01-2005 07:50 PM


All times are GMT +5.5. The time now is 07:06 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36