2

I would like to document a directory structure, and installed tree to do so. I don't wish to include files but only directories and symbolic links which point to directories (haven't decided if the symlinks should be recursive, and either way is fine). There are some directories which I would like to include the directory name, but not any directories (or files) within it.

Looks like I need -d to only display directories. I have been able successful exclude directories using -I somedirectory, however, not to exclude sub-directories such as -I somedirectory/somesubdirectory.

For instance, the intent of the below command is to display all directories and sub-directories within ~/some/base/directory/ except for sub-directories within ~/some/base/directory/myfirstdirectory/notthisone or ~/some/base/directory/myotherdirectory/oreventhisone (note that ~/some/base/directory/myfirstdirectory/notthisone, etc should be included but just not its sub-directories).

tree -d -I "myfirstdirectory/notthisone|myotherdirectory/oreventhisone" ~/some/base/directory

I've also tried escaping / or replacing it with a . wildcard.

How are given sub-directories excluded from tree's output?

user1032531
  • 1,897
  • 6
  • 31
  • 36

0 Answers0