Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
苹果系统。我想复制一个名为“bundleDir”的目录,它有一些像“.svn”这样的子目录。同样在目录 bundleDir 中还有其他目录具有“.svn”这样的树
bundleDir ----.svn ----dirM ----.svn ----a.txt ----b.txt
我想以递归方式将 bundleDir 复制到另一个目录排除 .svn 。我怎样才能做到这一点 ?
IFS=$'\n'; for f in $(find bundleDir -depth | grep -v '/\.svn[/$]'); do d=~/target/"${f%/*}"; mkdir -p "$d"; cp -n "$f" "$d"; done
cp -R bundleDir ~/target; find ~/target -type d -name .svn -delete