Skip to content

Instantly share code, notes, and snippets.

@commonquail
Last active August 31, 2015 11:52
Show Gist options
  • Save commonquail/627ad1353f00f552d5ed to your computer and use it in GitHub Desktop.
Save commonquail/627ad1353f00f552d5ed to your computer and use it in GitHub Desktop.
Skip VCS directories with find

This command recursively finds every file matching the glob pattern *.* (name.extension) in the working directory, excluding child directories whose names start with ..

This is useful for skipping various VCS directories, for instance.

find . -type d -path './.*' -prune -o -type f -name '*.*' -print

There is a lot of misleading and confusing information on the Internet about how to achieve this.

One important thing to remember is that find prepends ./ to every result, accounting for the first part of the -path argument.

The -name argument is included to demonstrate additional filters. Omitting it would yield every file.

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