nixCraft Linux Forum

nixCraft

Linux / UNIX 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.....

Register free or login to your existing account and remove all advertisements.


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

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #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
  #2 (permalink)  
Old 09-06-2005, 11:58 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
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
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
Default

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


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 Off


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 05:12 AM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

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 37 38