简体   繁体   中英

How can I delete all files starting with ._ from the shell in Linux?

As the title really. I have copied over a number of files to a Raspberry Pi from a Mac. This has resulted in lots of superfluous files starting with the prefix ._ . I want to delete every file in a folder that starts with ._ . How would I do this?

Try something like:

cd /path/to/directory; \rm -rf ._*

OR if there are recursive files with in subfolders then try:

find /path/to/directory -name "._*" -type f -print0| xargs -0 \rm -rf

The EASY WAY:

to remove files starting with a string like : example-1.html, example-2.js, ...

 rm examp*

to remove directories starting with a string like : example-1/, example-1-1-0/, example-2/, ...

rm -rf examp*

PS:

-r for recursively

-f for force (the erasing as used for not empty directories)

that's all folks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM