how to find some dir


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to find some dir
# 8  
Old 09-17-2007
wondering why

Just wondering why it has to be on one line......?
# 9  
Old 09-18-2007
Solution!

If i were you , this is what i would do

$ ls -lRt | grep -v Archive
<notice the 'R' , its list RECURSIVE>

or here is another one:

$ for x in `ls -lF | grep '/' | grep -v Archive`;do
echo $x | cut -f 9 | ls -lR
done

summary:
Note: encapsulate the ls -lF ... line within FOR by using tilde [character left of number 1 on standard keyboard]

here i am looping thru all the directories <except archive> and listing there contents

for the curious ls -F gives the list but adds a '/' infront of directory names!

make suitable replacements for names u need.
Let me know if it helps!

-Samarth
# 10  
Old 09-18-2007
Code:
$ find . -print
.
./archive
./archive/decisions
./archive/error
./archive/logs
./archive/processed
./archive/results
./config
./decisions
./error
./inbox
./logs
./outbox
./processed
./progress
./results
$ find . \( -name archive -prune \) -o -print
.
./config
./decisions
./error
./inbox
./logs
./outbox
./processed
./progress
./results
$

# 11  
Old 09-19-2007
With zsh:

Code:
print -l **/*~archive*


For example:

Code:
zsh 4.3.4% mkdir -p archive/results config
zsh 4.3.4% find
.
./archive
./archive/results
./config
zsh 4.3.4% print -l **/*~archive*
config

# 12  
Old 09-19-2007
thanx..thanx

thanx everybody for your help and co-operations......Smilie
# 13  
Old 09-24-2007
Quote:
Originally Posted by Perderabo
Code:
$ find . -print
.
./archive
./archive/decisions
./archive/error
./archive/logs
./archive/processed
./archive/results
./config
./decisions
./error
./inbox
./logs
./outbox
./processed
./progress
./results
$ find . \( -name archive -prune \) -o -print
.
./config
./decisions
./error
./inbox
./logs
./outbox
./processed
./progress
./results
$

suppose i don't want to traverse progress and decision folder ..how i am going to achieve......thru same line
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. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: Movomito
4 Replies

8. 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

9. 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

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