刪除目錄下檔案

2021-09-26 20:01:50 字數 705 閱讀 8881

刪除當前目錄下的檔案

1.rm -f *

#最經典的方法,刪除當前目錄下的所有型別的檔案

2.find . -type f -delete或find . -type f -exec rm -f {} \;

#用find命令查詢普通檔案並刪除or用find命令的處理動作將其刪除

3.find . -type f | xargs rm -f

#用於引數列表過長;要刪除的檔案太多

4.rm-f `find . -type f`

#刪除全部普通檔案

5.for delete in `ls -l`;do rm -f * ;done

#用for迴圈語句刪除當前目錄下的所有型別的檔案

刪除指定目錄下的檔案

1.rm -f 指定目錄*

#最經典的方法,刪除指定目錄下的所有型別的檔案

2.find 指定目錄 -type f -delete或find 指定目錄 -type f -exec rm -f {} \;

#用find命令查詢指定目錄下的所有普通檔案並刪除or用find命令的處理動作將其刪除

3.find 指定目錄 -type f | xargs rm -f

#用於引數列表過長;要刪除的檔案太多

4.rm-f `find 指定目錄 -type f`

來自 <>

vc 刪除目錄或檔案與目錄下檔案

因為vc中沒有刪除非空目錄的函式,所以要用以下方法來做 注意 路徑字串str的最後不要加 void deletedir cstring str else 不是資料夾 deletefile strdel 刪除檔案 api finder.close removedirectory str 刪除資料夾 a...

vc 刪除目錄或檔案與目錄下檔案

因為vc中沒有刪除非空目錄的函式,所以要用以下方法來做 注意 路徑字串str的最後不要加 void deletedir cstring str else 不是資料夾 deletefile strdel 刪除檔案 api finder.close removedirectory str 刪除資料夾 a...

目錄下檔案計數

每個linux下的path中包含的系統變數都有好多路徑 root wl ms 7673 home wl 桌面 shell echo path usr local sbin usr local bin usr sbin usr bin sbin bin usr games usr local arm ...