Skip to content

linux下批量删除规定大小的文件

转载本站文章请注明:
转载来至:[记录与PHP的PK经历]
本文链接: linux下批量删除规定大小的文件

find . -size -653c -exec rm {} ;

注解:find [目录] -size -[文件大小.单位字节]c -exec rm {} ;

使用前先使用
find . -size -653c
测试看查找出来的文件是否正确,然后再正式删除!



中文关键字:linux 文件 目录 大小 前先 find size 注解 exec 字节 653 然后 正确 单位 正式

One Comment

  1. askie

    //另外的方法
    fsize=`wc -c ./* | awk ‘{print $1}’`
    if ( $fsize -eq 1048576 )
    then
    rm 目录/test
    fi

    Posted on 23-Jun-08 at 11:59 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).