close

 

ptt網友的問題, 多年前好像也曾遇過 :p

find . -name *.txt | xargs -i cp {} /tmp/{}.`date +%Y-%m-%d`

man find

man xargs

manual的範例

find /tmp -name core -type f -print | xargs /bin/rm -f
找到/tmp下,檔案名稱為core, 並刪除掉

find . -type f -exec file '{}' \;
在目前所在的目錄,對每個檔案,執行file 指令

注意,這裡的雙大括號是以單引號包起來

find . -perm  權限相關...

 

有更多的問題!

google it!

 

列出某個檔中有想找的關鍵字

grep -il "關鍵字" *.txt

 

子目錄一起搜尋

find . -type f -name \*.txt -exec grep -il "國民電腦" {} \;

arrow
arrow
    全站熱搜

    igogo 發表在 痞客邦 留言(2) 人氣()