15

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

3 Answers 3

18
rm ./._*

more stuff since it must be at least 15 characters.

2
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
6
  • 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. Jun 28, 2010 at 15:14
  • 1
    awesome. This one should be accepted as answer rather than the one above. Mar 29, 2016 at 0:15
  • 5
    Or, more simply: find . -iname "._*" -delete Jun 22, 2016 at 21:03
  • @ChristopherAltman, is this is really what you needed, you should accept this answer instead? Aug 26, 2016 at 20:56
  • 2
    -name should be sufficient instead of -iname
    – rooby
    Sep 5, 2016 at 4:06
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

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .