The UNIX and Linux Forums  

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
regex to remove commentaries and blanks yomaya Shell Programming and Scripting 7 06-18-2009 08:22 AM
regex to remove text before&&after comma chars yomaya Shell Programming and Scripting 3 06-08-2009 06:44 AM
How to deleting some files under subdirectory AdziE Shell Programming and Scripting 4 08-20-2008 09:05 AM
Count files in every subdirectory yorryk Shell Programming and Scripting 3 08-12-2008 06:22 PM
subdirectory password sskb UNIX for Dummies Questions & Answers 1 09-24-2001 06:17 PM

Reply
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 4 Weeks Ago
Scrutinizer Scrutinizer is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 761
Assuming there are only subdirectories in $DIRECTORY that start with "fs", this should work:

Code:
find $DIRECTORY/fs*/* -type d -printf "'%p'\n"|sort -r |xargs rmdir 2>&-

  #2 (permalink)  
Old 4 Weeks Ago
janel10 janel10 is offline
Registered User
  
 

Join Date: Nov 2009
Location: Florida
Posts: 4
There are directories under, so this doesn't work. The directories look like this:
/directory/images/fsa/09005573FRA
/directory/images/fsa/09004364EVA

It is these 0900.... directories that need to be removed.
There a literally hundreds of these subdirectories that I need to remove. I guess my question wasn't clear enough. Can you still help me?
  #3 (permalink)  
Old 4 Weeks Ago
Scrutinizer Scrutinizer is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 761
Actually I think that should work. You seem to confirm that there are only subdirectories called fs* (e.g. fsa) in $DIRECTORY (/directory/images). These subdirectories must not be removed but the subdirectories inside these subdirectories do have to be removed if they are empty (i.e. contain no files or further subdirectories).

S.
Reply

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 06:11 AM.


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