The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Excluding directories with find x96riley3 UNIX for Dummies Questions & Answers 3 04-08-2009 04:12 AM
Find but exclude directories tadi18 Shell Programming and Scripting 9 09-12-2008 11:34 AM
to find a file in set of directories jazz High Level Programming 3 11-16-2005 09:36 AM
Find directories not containing foo, and copy foo to them dkaplowitz Shell Programming and Scripting 6 06-29-2005 08:50 AM
Find files in Directories steiner Shell Programming and Scripting 4 04-02-2005 12:01 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2009
ddk2oo5 ddk2oo5 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 9
find directories

I am looking a script which will find garbase directories (10 char. long)..which need to delete empty dir excluding symlink and system directories.
I tried this partial script but it just find directories create a file which contains link directories..can somebody help me to complete this scripts.

!#/usr/bin/sh

for dir in $(find / -type d -name '??????????')
do ll $dir | grep ^l > /home/user/linklist
if [ ls $dir eq 0 ] then rmdir $dir # not sure abt this line
done
  #2 (permalink)  
Old 03-18-2009
aaaaargh aaaaargh is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 20
Define "system directories". Also, doing a find of "/" will take a very long time and you may not have permissions depending on your access.

You may wait to use
Code:
-fstype ext3
to avoid any problems.
  #3 (permalink)  
Old 03-18-2009
ddk2oo5 ddk2oo5 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 9
find directories

HI have super access , i want to exclude directories they have link jusyt want to delete empty directories with 10 charactor long
  #4 (permalink)  
Old 03-18-2009
aaaaargh aaaaargh is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 20
Be very careful when you run this.

First identify what the directories are:
Code:
find / -name "??????????" -type d -empty -ls
Then delete (be careful, I am warning you)
Code:
find / -name "??????????" -type d -empty -exec rmdir {} \;
  #5 (permalink)  
Old 03-19-2009
ddk2oo5 ddk2oo5 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 9
getting error..

find / -name '??????????' -type d -empty -ls
find: 0652-017 -empty is not a valid option.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 05:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0