Is there a command line to remove all "._foo.html" files in a directory on Unbuntu?
Asked
Active
Viewed 2.3k times
3 Answers
37
I use the following command to remove all of those annoying Apple files, but this one also does it recursively through all sub-directories, too:
# find . -iname '._*' -delete

Khurram Raza
- 103
- 3

James
- 1,021
- 1
- 6
- 4
-
3+1 I came back to my question after I realized a recursive version of this command is what I really need. Thank you for adding the answer. – Christopher Altman Jun 28 '10 at 15:14
-
1awesome. This one should be accepted as answer rather than the one above. – Damodar Bashyal Mar 29 '16 at 00:15
-
5Or, more simply: `find . -iname "._*" -delete` – Dan Loewenherz Jun 22 '16 at 21:03
-
@ChristopherAltman, is this is really what you needed, you should accept this answer instead? – Steven C. Howell Aug 26 '16 at 20:56
-
2-name should be sufficient instead of -iname – rooby Sep 05 '16 at 04:06
-
If you get paranoid (like me) you can always do a "dry run" on these types of executable-finds by first running them sans-exec: `find . -iname '._*'` – Kyle Challis Jan 30 '18 at 22:36
18
rm ./._*
more stuff since it must be at least 15 characters.

karmawhore
- 3,865
- 18
- 9
-
1Also, this resource http://support.apple.com/kb/ht1629 may be helpful in preventing their creation in the first place. – Chris Nava Jun 23 '10 at 21:14
-
1
1
I use James' answer so often during webdevelopment I created my own command in
~/.bash_profile
alias rmd=rmdotfiles
rmdotfiles(){
if [ -z "$1" ]; then
local path=.
else
local path=$1
fi
find $path -iname '._*' -exec rm -rf {} \;
}
Remember to type . ~/bash_profile
after editing the file to make it available.
EDIT:
Example usage: rmd /path/to/dir

Ogier Schelvis
- 111
- 4
-
1Also I found that for Mac OSX Users working locally you can use a dot_clean command https://apple.stackexchange.com/a/136801/193609 and https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/dot_clean.1.html – Ogier Schelvis Dec 01 '17 at 10:25