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 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
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
add comment

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

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

5 Answers

up vote 4 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
add comment

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
add comment

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
add comment

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
add comment

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

share|improve this answer
add comment

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.