Finding multiply directories


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Finding multiply directories
# 1  
Old 12-20-2011
Question Finding multiply directories

I have multiply directories scattered throughout my system that end in 2011.
Example:
Code:
one_2011
two_2011
three_2011
etc....

I'm trying to find all of these directories but coming up short.

I tried
Code:
find / -type d -name *2011 > example

Any suggestions? I already searched in the forums but couldn't find anything.

Thanks in advance.

Moderator's Comments:
Mod Comment Please use

code tags!

Last edited by vbe; 12-20-2011 at 12:14 PM..
# 2  
Old 12-20-2011
The command looks OK to me. What part isn't working?
# 3  
Old 12-20-2011
Try putting "*2011" inside quotes. The * may be expanding in the shell before find is even run, fouling up your command.
This User Gave Thanks to Corona688 For This Post:
# 4  
Old 12-20-2011
What does not work in your command? To me it works unless you are unhappy with the output which is something different...
Code:
$ find / -type d -name *2011 > example
find: 0652-023 Cannot open file /proc/36882.
$ more example
/var/errpt/n12/2011
/prd/data/mnt2/rdh/juin2011
/prd/data/mnt2/rdh/mars2011
/prd/data/mnt2/rdh/sep2011
example: END

# 5  
Old 12-20-2011
Quote the name string - otherwise the shell may expand it before find sees it (so you'll only get ./*2011).
# 6  
Old 12-20-2011
Quote:
Originally Posted by vbe
What does not work in your command? To me it works unless you are unhappy with the output which is something different...
Code:
$ find / -type d -name *2011 > example
find: 0652-023 Cannot open file /proc/36882.
$ more example
/var/errpt/n12/2011
/prd/data/mnt2/rdh/juin2011
/prd/data/mnt2/rdh/mars2011
/prd/data/mnt2/rdh/sep2011
example: END

I'm not getting any output. Seems like it runs forever and nothing happens.
# 7  
Old 12-20-2011
Define 'forever' Smilie. Searching from / will take a long time on most systems, particularly if you have some remote filesystems.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding files deep in directories

i need to find a portable way to go through multiple directories to find a file. I've trid something like this: find /opt/oracle/diag/*/alert_HH2.log -printordinarily, i can run the ls command and it will find it: /opt/oracle/diag/*/*/*/*/alert_HH2.log The problem with this approach is... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Shell Programming and Scripting

Finding directories with expression

Hi All, I need your help in finding pattern of directories. need to search for all pattern have "mypatern" from base directory folder. example ------- server1 - base directory 100 server1/ab_123456_1/mypattern 100 server1/ab_123456_2/mypattern 200 server1/ab_123457_1/mypattern... (13 Replies)
Discussion started by: lxdorney
13 Replies

3. UNIX for Dummies Questions & Answers

Finding size of all directories

Alright so I've tried a couple different things that at first glance, looked like they worked. find . -maxdepth 5 -type d -daystart -mtime 1 | xargs du -h Which seems to ignore the previous commands such as depth and modified time. find .. -maxdepth 2 -type d -daystart -ctime 1 | xargs... (8 Replies)
Discussion started by: Aussiemick
8 Replies

4. Shell Programming and Scripting

Finding directories older than 5 days

Hello, Motive: Search all directories which are older than 5 days. Example: consider following directory structure: abc/dir1 abc/dir1/dir abc/dir2 abc/dir3 abc/dir3/temp Suppose dir1 and dir3 are 5 days older. Then I am looking for a command which lists abc/dir1 and abic/dir3 only so that... (4 Replies)
Discussion started by: mytempid07
4 Replies

5. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

6. Shell Programming and Scripting

finding correct directories

I have directories like V00R01,V00R02,V01R01,V01R02 in a directory where V is version and R is a release. basically I need to set base directory and current directory. Under a version there can be any number of releases and there can be number of versions also. V00R01...V00R50..so on also,... (2 Replies)
Discussion started by: vjasai
2 Replies

7. UNIX for Dummies Questions & Answers

finding largest files (not directories)?

hello all. i would like to be able to find the names of all files on a remote machine using ssh. i only want the names of files, not directories so far i'm stuck at "du -a | sort -n" also, is it possible to write them to a file on my machine? i know how to write it to a file on that... (2 Replies)
Discussion started by: user19190989
2 Replies

8. Shell Programming and Scripting

Expression for Finding Multiple Directories..??

I am writing a shell script to search for previous versions of an application...the application is called TAU and basically i want to search the users home directory and /Applications for any instances of a "TAU" folder.. If found i want to give the user the option to remove the old folders and if... (3 Replies)
Discussion started by: meskue
3 Replies

9. UNIX for Dummies Questions & Answers

Finding executable files in all directories

This is probably very easy but I would like to know a way to list all my files in all my directories that are readable and executable to everyone. I was told to use find or ls and I tried some stuff but couldnt get it to work. I understand that its dangerous to have files with these permissions for... (4 Replies)
Discussion started by: CSGUY
4 Replies

10. UNIX for Dummies Questions & Answers

finding directories in UNIX

I am accessing a UNIX server via FTP. I want to retieve a file in a directory. What is the UNIX command that I need to view and retrieve files from a directory? (1 Reply)
Discussion started by: yodaddy
1 Replies
Login or Register to Ask a Question