1. 批量刪除空檔案(大小等於0的檔案)
find . -name "*" -type f -size 0c | xargs -n 1 rm -f
2. 刪除指定size大小檔案
find . -name "*" -type f -size 1024c | xargs -n 1 rm -f
ps: 此處即刪除1k大小的檔案. (但注意不要用 -size 1k,這個得到的是占用空間1k,不是檔案大小1k的)
3. 查詢出所有的空資料夾
find -type d -empty
4. 列出搜尋到的檔案
find . -name "*.txt" -exec ls -l {} \;
5. 批量刪除搜尋到的檔案
find . -name "*.txt" -exec rm -f {} \;
6. 刪除前有提示
find . -name "*.txt" -ok rm -rf {} \;
linux中find批量刪除空檔案及空資料夾指令碼
linux 下批量刪除空檔案 大小等於0的檔案 的方法 find name type f size 0c xargs n 1 rm f用這個還可以刪除指定大小的檔案,只要修改對應的 size 引數就行,例如 find name type f size 1024c xargs n 1 rm f注 刪除...
Linux下批量刪除空檔案
linux下批量刪除空檔案 大小等於0的檔案 的方法 find name type f size 0c xargs n 1 rm f 用這個還可以刪除指定大小的檔案,只要修改對應的 size 引數就行,例如 find name type f size 1024c xargs n 1 rm f 就是刪...
Python刪除空檔案和空資料夾的方法
coding cp936 os.walk 函式宣告 walk top,topdown true,onerror none 1 引數top表示需要遍歷的目錄樹的路徑 2 引數topdown的預設值是 true 表示首先返回目錄樹下的檔案,然後在遍歷目錄樹的子目錄.topdown的值為www.cppcn...