Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to remove all files and directories starts with ._ recursively:

find . -name \._* | xargs rm

How can this be done on Windows using a DOS/shell command (without Cygwin)?

share|improve this question

migrated from Oct 27 '09 at 3:04

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

Not allowed to use powershell? – Clay Fowler Oct 27 '09 at 1:46
can someone provide the powershell command again? – Anonymous Oct 27 '09 at 2:46
The unix command you provide above for will only work for files. Should the contents of matching directories also be deleted? That is, if directory ._d contains file f, should ._d be removed or not? – Zac Thompson Oct 27 '09 at 4:34
up vote 5 down vote accepted

Have you tried del /s ._* ?

share|improve this answer
I need to do this recursively for all subdirectories/files – Anonymous Oct 27 '09 at 2:01
The /S option will delete files from all subdirectories. If you're looking to delete subdirectories as well, you should edit your question to reflect that. – Michael Petrotta Oct 27 '09 at 2:04
edited for deleting subdirectories and files recursively – Anonymous Oct 27 '09 at 2:12

Download unxutils . It has all the commands you listed.

share|improve this answer
looks like the link is down – Anonymous Oct 27 '09 at 2:07

you could use a for loop:

for /f "delims=" %a in ('dir /B /S *._*') do del "%a"

note this may be overkill, considering the simplicity of Adam Liss's answer.

share|improve this answer
+1 for the 'for /f' - this is the way to do xargs-ish stuff under cmd. Could easily be modified into a complete solution: add another line for removing directories (replace 'del' with 'rmdir /s /q'). Loop until 'dir /b /s ._*' returns nothing (you have an extra * in there). – Zac Thompson Oct 27 '09 at 4:43

If you are comfortable with UNIX tools then you can try installing the Berkeley Utilities which are ports of all your favourites like grep , awk and sed etc for windows.

share|improve this answer
doesn't support pipe though... – Anonymous Oct 27 '09 at 2:03

If you want to get unix tools on windows, get those from GNU

share|improve this answer

You must log in to answer this question.

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