Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to find the command to delete recursively all Apple Mac generated files such as '._' from the drive. So far I have:

find . -name '._*' -exec rm -rf {} \;

however it doesn't seem to do the trick.

share|improve this question

migrated from stackoverflow.com Dec 20 '12 at 17:15

This question came from our site for professional and enthusiast programmers.

1  
Sorry, this is off-topic. Try superuser.stackexchange.com –  Joe Dec 20 '12 at 16:20
    
How is this off topic? Isn't ssh covered here - I've seen several posts for ssh, but none explaining how to achieve the above. –  Spencer Mark Dec 20 '12 at 16:39
    
They might have been old questions. Since StackOverflow launched, lots of StackExchanges have sprung up to fill specialisms. Those questions might have appeared before that StackExchange site existed. –  Joe Dec 20 '12 at 17:01
    
(I know how frustrating it is to have something marked off-topic, but it needs a number of votes from the community to confirm it so it's nothing personal.) –  Joe Dec 20 '12 at 17:02
    
What do you observe? –  Nicole Hamilton Dec 20 '12 at 17:23

2 Answers 2

Using the dot as first argument starts in the directory you are currently in.

If you want to find all files beginning with ._ you should use the slash as first parameter so that find starts at the root-directory.

And as some of these files will not be owned by you you might like to use the suso command also.

So the complete command looks like this:

sudo find / -name "._*" -exec rm -rf {} \;

At least for me that always does the trick. Ommiting the -exec part will simply list all files so you might run this first to see whether all files are found you expect

share|improve this answer

find . ( -name '._*' ) -exec rm {} -rf \; should work

I don't know if it's different in OSX compared to bash.

share|improve this answer
    
Macs run Bash and certainly have find although I think it's a bit out of date. The man page says 2008, but I'm sure it'll be sufficiently up to date. –  Joe Dec 20 '12 at 23:03

Your Answer

 
discard

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