2010-11-15 168 views
3

我正在嘗試查找與CVS相比不是最新的所有文件。由於我們的CVS結構被破壞了(它在某些目錄中沒有好轉),我試圖通過查找來解決它。從查找中排除某些文件名模式和目錄

我現在是這樣的:

for i in `find . -not \(-name "*\.jpg" \) -path './bookshop/mediaimg' -prune -o -path '*/CVS*' -prune -o -path './files' -prune -o -path './images/cms' -prune -o -path './internal' -prune -o -path './limesurvey171plus_build5638' -prune -o -path './gallery2' -prune -o -print `; do cvs status "$i" |grep Status ; done &>~/output.txt 

但不知何故,我在不包括圖片(JPG格式在這種情況下)不工作的嘗試,他們仍然顯示。 任何人都有關於如何從查找中找出結果的建議?

回答

2

由於混合布爾AND和OR總是失敗的原因,這是失敗的。

你說這裏有什麼真正的(僞代碼):

If (
    File Not Named '*.jpg' AND 
    Path Matches './bookshop/mediaimg' AND 
    Prone OR 
    Path Matches '*/CVS*' AND 
    Prune OR 
    Path Matches './files' AND 
    Prune OR 
    Path Matches './images/cms' AND 
    Prune OR 
    Path Matches './internal' AND 
    Prune OR 
    Path Matches './limesurvey171plus_build5638' AND 
    Prune OR 
    Path Matches './gallery2' AND 
    Prune OR 
    Print 
) 

現在,打印總是返回true,我認爲西梅不一樣,所以你看,沒有一個與運算的事如果有任何OR匹配。圓括號的仔細應用可能會產生你所追求的結果。

+0

謝謝,真的很有用 – Maarten 2010-11-19 07:44:23

相關問題