3

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

3
  • 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? Oct 27 '09 at 4:34
7

Have you tried del /s ._* ?

3
  • 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. Oct 27 '09 at 2:04
  • edited for deleting subdirectories and files recursively
    – Anonymous
    Oct 27 '09 at 2:12
1

Download unxutils . It has all the commands you listed.

1
  • looks like the link is down
    – Anonymous
    Oct 27 '09 at 2:07
1

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.

1
  • +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). Oct 27 '09 at 4:43
0

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.

1
  • doesn't support pipe though...
    – Anonymous
    Oct 27 '09 at 2:03
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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