Is there a command line to remove all "._foo.html" files in a directory on Unbuntu?

share|improve this question
up vote 15 down vote accepted
rm ./._*

more stuff since it must be at least 15 characters.

share|improve this answer
1  
Also, this resource 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  
./ is redundant. – kasperd May 22 '17 at 7:34

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 '._*' -exec rm -rf {} \;
share|improve this answer
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
1  
awesome. This one should be accepted as answer rather than the one above. – Damodar Bashyal Mar 29 '16 at 0:15
4  
Or, 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
1  
-name should be sufficient instead of -iname – rooby Sep 5 '16 at 4:06

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

share|improve this answer
    
Also I found that for Mac OSX Users working locally you can use a dot_clean command apple.stackexchange.com/a/136801/193609 and developer.apple.com/legacy/library/documentation/Darwin/… – Ogier Schelvis Dec 1 '17 at 10:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.