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)?

link|improve this question

25% accept rate
3  
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
feedback

migrated from stackoverflow.com Oct 27 '09 at 3:04

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

5 Answers

Have you tried del /s ._* ?

link|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
feedback

Download unxutils . It has all the commands you listed.

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

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.

link|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
feedback

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.

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

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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