Consider this directory (and file) structure:
mkdir testone
mkdir testtwo
mkdir testone/.svn
mkdir testtwo/.git
touch testone/fileA
touch testone/fileB
touch testone/fileC
touch testone/.svn/fileA1
touch testone/.svn/fileB1
touch testone/.svn/fileC1
touch testtwo/fileD
touch testtwo/fileE
touch testtwo/fileF
touch testtwo/.git/fileD1
touch testtwo/.git/fileE1
touch testtwo/.git/fileF1
I would like to print/find all files which are in these two directories, but excluding those in the subdirectories .git
and/or .svn
. If I do this:
find test*
... then all the files get dumped regardless.
If I do this (as per, say, How to exclude/ignore hidden files and directories in a wildcard-embedded “find” search?):
$ find test* -path '.svn' -o -prune
testone
testtwo
$ find test* -path '*/.svn/*' -o -prune
testone
testtwo
... then I get only the top-level directories dumped, and no filenames.
Is it possible to use find
alone to perform a search/listing like this, without piping into grep
(i.e. doing a find
for all files, then: find test* | grep -v '\.svn' | grep -v '\.git'
; which would also output the top-level directory names, which I don't need)?