aspose file tools*
The moose likes Linux / UNIX and the fly likes Using find, excluding directories Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Using find, excluding directories" Watch "Using find, excluding directories" New topic
Author

Using find, excluding directories

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 826
Directory TEST has sub-directories dir1, dir2, dir3 .... dir 100

When I use the following command
find TEST -print
will display dir1 , dir2, dir3 ... dir100 and all files below these directories.

When using the command
find TEST -name dir1 -print
will display dir1 and all files below this directory.

Is there a find command that will display all directories except dir1?
I appreciate any info anyone can give on this. Thanks in advance.

Rob
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Probably depends on the OS and the particular implementation of find.

You might try something like:



Guy
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Rob Hunter wrote:
find TEST -name dir1 -print
will display dir1 and all files below this directory.

Is there a find command that will display all directories except dir1?

It doesn't print files below dir1 in my case (Linux/ find (GNU findutils) 4.4.0).

However, I would try a 'not'



http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using find, excluding directories