简体   繁体   中英

How to match(unmatch) repositories in folder with find?

I has following command to find all standart files and folders:

find /home/user/ \( ! -path "*/\.*" \) \( ! -type l \)

This find matches all but dot files/dirs with it's content and symlinks.

Also I want to exclude my git and hg repositories entirely (both repo folder name and it's content) too.

I know about .git and .hg folder's. But I can't understand how to use this in regex.

Try this:

find /home/user  \! -type l | egrep -v '/\..*'

This will find all files which are not symlink and grep will exclude any hidden file or hidden directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM