Skip to content

Instantly share code, notes, and snippets.

@dcorking
Last active May 17, 2017 08:01
Show Gist options
  • Save dcorking/f7955a8a74b8ad4606f9 to your computer and use it in GitHub Desktop.
Save dcorking/f7955a8a74b8ad4606f9 to your computer and use it in GitHub Desktop.
Notes on findutils
# This is not the official way to prune directories, but I found it easier.
# It prints the contents of all the files in the tree - excluding .git and CachedPixmaps,
# but there is a potential bug in the second globbed file name
#
# Works with GNU findutils. Might not work with BSD find, such as Mac OS X.
find -not -wholename './.git*' -not -wholename '*CachedPixmaps*' -type f |xargs cat
@dcorking
Copy link
Author

dcorking commented Jul 1, 2014

It turns out my approach is supported by a Stack Overflow answer that has more votes than the accepted answer http://stackoverflow.com/questions/4210042/exclude-directory-from-find-command/15736463#15736463 (-wholename is a newer synonym for -path)

find . -not -wholename './.git*'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment