V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
laputaprince
V2EX  ›  Linux

求bash大神解答。

  •  
  •   laputaprince · 2014-01-07 10:34:40 +08:00 · 2956 次点击
    这是一个创建于 3775 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    1970-01-01 08:00:00 +08:00
    liberize
        1
    liberize  
       2014-01-07 11:21:16 +08:00
    find . \( -not -path './dir1/*' -and -not -path './dir2/*' -or -path './dir1/subdir1/*' \) -type f
    laputaprince
        2
    laputaprince  
    OP
       2014-01-07 12:16:14 +08:00
    谢谢,我reputation不够,up vote不了。。
    laputaprince
        3
    laputaprince  
    OP
       2014-01-07 15:04:38 +08:00
    find ./ -not \( \( -path './dir1*' -and -not -path './dir1/subdir1*' \) -o -path './dir2' -prune \)

    加prune 应该会快些。
    liberize
        4
    liberize  
       2014-01-07 19:23:24 +08:00
    考虑prune的话,应该可以把subdir2之类的也prune掉,我更新了一下回答,你可以看一下。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   6091 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 01:54 · PVG 09:54 · LAX 18:54 · JFK 21:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.