![](/img/trans.png)
[英]How can I find and delete files based on date in a linux shell script without find?
[英]How can I delete all files starting with ._ from the shell in Linux?
作為標題真的。 我已經從Mac上復制了許多文件到Raspberry Pi。 這導致了許多以前綴._
開頭的多余文件。 我想刪除以._
開頭的文件夾中的每個文件。 我該怎么做?
嘗試類似的東西:
cd /path/to/directory; \rm -rf ._*
或者,如果子文件夾中有遞歸文件,請嘗試:
find /path/to/directory -name "._*" -type f -print0| xargs -0 \rm -rf
簡單方法:
刪除以字符串開頭的文件,例如:example-1.html,example-2.js,...
rm examp*
刪除以字符串開頭的目錄,例如:example-1 /,example-1-1-0 /,example-2 /,...
rm -rf examp*
PS:
-r用於遞歸
-f for force(用於非空目錄的擦除)
這是所有人!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.