zoukankan      html  css  js  c++  java
  • find

    find start_directory test options criteria_to_match action_to_perform_on_results

    -perm mode:文件许可正好符合mode

    -perm +mode:文件许可部分符合mode

    -perm -mode:文件许可至少符合mode

    忽略某个目录:

    如果在查找文件时希望忽略某个目录,那么可以使用-prune选项来指出需要忽略的目录。在使用-prune选项时要当心,因为如果你同时使用了-depth选项,那么-prune选项就会被find命令忽略。

    例如:在/apps目录下查找文件,而不再/apps/bin目录下查找,可以用:

    find /apps -path "/apps/bin" -prune -o -print

    find ./ -path ./out -prune -o -name *AudioSystem.* -print
    注意是"./out" 而非 "out"

    -path 只是匹配find出来的路径,可以通过使用匹配符号* [] ?

    避开数个文件夹:

    find /usr/sam \(-path /usr/sam/dir1 -o -path /usr/sam/file1 \) -prune -o print

    查找某一确定文件: -name 等选项加在 -o 子后

    find /usr/sam \( -path /usr/sam/dir1 -o -path /usr/sam/file1 \) -prune -o -name "temp" -print

    指定多个起始目录:

    find /usr/home   /tmp  -name "*.c"

    查找大于 10MB 的所有文件

    find / ­size +10000k –xdev –exec ls –lh {}\;

    The following command finds all the files not modified in the last 60 days
    
    under /home/jsmith directory and creates an archive files under /tmp in the
    
    format of ddmmyyyy_archive.tar.
    
    # find /home/jsmith -type f -mtime +60 | xargs tar -cvf
    
    /tmp/`date '+%d%m%Y'_archive.tar` 
  • 相关阅读:
    asp.net mvc学习(Vs技巧与Httpcontext)
    微信小程序代码构成
    MetaEditor中MQL使用方法
    lambda表达式中的排序问题
    Python Bs4 回顾
    Python操作Redis及连接方式
    C# for Python(Nugut Iron包)
    Jquery.ajax dataType参数
    Fleck For Web Socket
    visual studio git for coding
  • 原文地址:https://www.cnblogs.com/openix/p/2917429.html
Copyright © 2011-2022 走看看