Find /Dir


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find /Dir
# 1  
Old 04-23-2008
Find /Dir

Here is the problem i now have.

i have a list of directories like this

W9888
W9848
W9752
W9748
W9683
W9680
W9674
W9558
W9366

i need to scan through those directories and bring back a similar list, except only of the directories not containing subdirectories called "ebooks" or "e*" I had some help with this earlier and resolved all other issues i was having except for this one.

the list i get back could really only be one line less, but i am doing this over thousands of files.

here is what i have tried so far but it does not work.

find ./$line -maxdepth 1 -type d \! -name "e*" > noebook.txt

i'm running leopard
# 2  
Old 04-23-2008
Code:
#!/bin/ksh
while read dir
do
     set -A arr  $(find $dir -type d -name 'e*' )
     if [[ ${#arr} -eq 0 ]] ; then
             echo $dir
     fi
done < dirfile > newdirfile

# 3  
Old 04-23-2008
is there anyway to do this in bash. simply using it as is doesn't seem to work and i need to apend it to the end of an already working script.

Thanks
# 4  
Old 04-24-2008
Does the subdirectory exist directly under the directory you are examining, or could it be nested arbitrarily deeply?

Code:
#!/bin/sh

find whatever you are already finding |
while read dir; do
  find $dir -type d -name 'e*' | grep . && continue
  echo "$dir"
done

# 5  
Old 04-24-2008
I have done it! Thankyou era and Jim Mcnamara. Your help is appreciated. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find directory immediately after the pattern dir name

Hi, From below directories path I need the directory which comes immediately after the "DataPath" /var/errors/LogDefaultPath/DataPath/Data01/Data02 (Directory name "Data01" is the result from this path) /var/errors/LogDefaultPath/DataPath/Log01/Log0202 (Directory name "Log01" is the... (4 Replies)
Discussion started by: Yuvaan12
4 Replies

2. Shell Programming and Scripting

KSH - Find paths of multiple files in CC (dir and sub-dir))

Dear Members, I have a list of xml files like abc.xml.table prq.xml.table ... .. . in a txt file. Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file. Please help me with the script or command to do so. ... (11 Replies)
Discussion started by: Yoodit
11 Replies

3. Shell Programming and Scripting

what is the find command to find exact dir from the root

I want to find a dir called STOP from the root.so what is the find command. Thanks & Regards Rajkumar (1 Reply)
Discussion started by: rajkumar_g
1 Replies

4. Shell Programming and Scripting

Find ,replace and overwrite from master and sub dir

Hello experts, Can someone please help me handling the below situation. I have files in multiple directories as below. /data/input/A.txt /data/input/a1.txt /data/input/adhoc/b.txt /data/input/adhoc/b1.txt /data/input/adhoc/temp/c.txt /data/input/adhoc/temp/d.txt where some of... (3 Replies)
Discussion started by: pasupuleti81
3 Replies

5. Shell Programming and Scripting

A script to find dir, delete files in, and then del dir?

Hello!! I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory: drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies

6. UNIX for Dummies Questions & Answers

How do I ignore certain dir while using find? solved.

Hello everyone, I'm a newbie. I've got a problem while using find. I know there is a way to do it in man find which is something like find . -wholename './src/emacs' -prune -o -print it works but i also want to use -daystart, -mtime, -type on it and i dont know whats the sequence of these... (0 Replies)
Discussion started by: aquaraider
0 Replies

7. UNIX for Dummies Questions & Answers

find and remove last week dir

hello all, I want to ask, how to find last week directory and then remove it.. I have a directory in path /home/backup/ and, inside backup dir, I have 6 dir : - 01_20080414 ( today date ) - 02_20080414 ( today date ) - 01_20080413 - 02_20080413 - 01_20080407 ( last week date ) -... (1 Reply)
Discussion started by: kunimi
1 Replies

8. UNIX for Dummies Questions & Answers

Find and purge a files in a dir

HI All, I have recuirement to purge the files in a directory . In that directory i an having many sub-directory . When i use find command like find ~/work/test/insert -name "*.*" -mtime +12 it is listing the file not accesed before 12 , It also takes the subdirectories inside the... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

9. Shell Programming and Scripting

how to find some dir

hi everybody, i have dir structure like this, . ./processed ./results ./archive ./archive/processed ./archive/results ./archive/logs ./archive/decisions ./archive/error ./logs ./inbox ./decisions ./progress ./outbox ./config ./error (12 Replies)
Discussion started by: manas_ranjan
12 Replies

10. Programming

To find a existence of a dir within a dir

Hi, I want to find whether a dir "temp" is present inside a dir. It should get a dir a input and search recursively within that directory to check whether temp is present and return 1 or return 0 if it is not present anywhere inside the directory/sub-directory. I know we can use readdir in the... (1 Reply)
Discussion started by: spsenthil
1 Replies
Login or Register to Ask a Question