Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2872

【1行野郎】複数パスを対象にディレクトリを列挙するが、特定ディレクトリのみ探索しない2

$
0
0
実行内容 下記で抽出したディレクトリに存在するファイルパスを取得する. ・【1行野郎】複数パスを対象にディレクトリを列挙するが、特定ディレクトリのみ探索しない $ echo /var/jenkins_home /home/foo | sed 's/\s\+/\n/g' | xargs -I@ find @ \( -type d 2>/dev/null -and \( -name '' -o -name '.git' -o -name '.cacahe' \) -prune \) -or \( -type d -and -print \) | xargs -I@ find @ -maxdepth 1 -type f ・最後の -maxdepth 1 を加えることでファイルパスを重複せずに得ることができる. ・fish shell v2.7.1 でも動作することを確認済み その他処理については下記を参照. 【1行野郎】複数パスを対象にディレクトリを列挙するが、特定ディレクトリのみ探索しない   以上

Viewing all articles
Browse latest Browse all 2872

Trending Articles