File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using find, excluding directories

 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably depends on the OS and the particular implementation of find.

You might try something like:



Guy
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic