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

求bash大神解答。

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

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