Skip to content

Instantly share code, notes, and snippets.

@pollenjp
Created April 21, 2019 02:41
Show Gist options
  • Save pollenjp/b6752bf4930e4ed052ee20d581c47ea9 to your computer and use it in GitHub Desktop.
Save pollenjp/b6752bf4930e4ed052ee20d581c47ea9 to your computer and use it in GitHub Desktop.
findコマンドのよく使う用法
# [findコマンドで否定の指定方法 - ゆるゆると](http://d.hatena.ne.jp/litt/20071029/p1)
# !をつけるだけ。例えば hoge/ の中にある .sh ファイルを列挙したいけど hoge/huge/ の中のあるものは除くって場合
find hoge/ -name '*.sh' ! -path 'hoge/huge/*'

find コマンドで指定条件を除外(exclude)して、特定の拡張子を対象から消すには - それマグで!

 % find . -mindepth 1 -maxdepth 1 -type d -not -name "static"
# 複数条件書いたらどうなるのか
 % find . -mindepth 1 -maxdepth 1 -type d -name "share" -not -name "static"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment