1

[Bash] find Command Exclude Sub-directory

 2 years ago
source link: http://siongui.github.io/2016/05/19/bash-find-command-exclude-subdir/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Bash] find Command Exclude Sub-directory

May 19, 2016

Use find command to find all HTML files in a directory, but exclude the HTML files in some sub-directory.

Quesion

Find all HTML files in output directory, but exclude the HTML files in output/extra and output/tag sub-directories.

Answer

find output/ -not \( -path "output/extra/*" -o -path "output/tag/*" \) -name "*.html"

Tested on: Ubuntu Linux 16.04, find (GNU findutils) 4.7.0-git

References:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK