Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
laputaprince
V2EX  ›  Linux

求bash大神解答。

  •  
  •   laputaprince · Jan 7, 2014 · 3490 views
    This topic created in 4529 days ago, the information mentioned may be changed or developed.
    4 replies    1970-01-01 08:00:00 +08:00
    liberize
        1
    liberize  
       Jan 7, 2014
    find . \( -not -path './dir1/*' -and -not -path './dir2/*' -or -path './dir1/subdir1/*' \) -type f
    laputaprince
        2
    laputaprince  
    OP
       Jan 7, 2014
    谢谢,我reputation不够,up vote不了。。
    laputaprince
        3
    laputaprince  
    OP
       Jan 7, 2014
    find ./ -not \( \( -path './dir1*' -and -not -path './dir1/subdir1*' \) -o -path './dir2' -prune \)

    加prune 应该会快些。
    liberize
        4
    liberize  
       Jan 7, 2014
    考虑prune的话,应该可以把subdir2之类的也prune掉,我更新了一下回答,你可以看一下。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   953 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 38ms · UTC 21:14 · PVG 05:14 · LAX 14:14 · JFK 17:14
    ♥ Do have faith in what you're doing.