Delete all hidden Mac junk files in Windows (Like .DS_STORE)

If you use a Mac and Windows together, you’re likely to end up with a bunch of hidden .DS_STORE files all over your Windows drives. You can easily search and destroy them all using this command:

(Open the command line first of course. You can do this by mashing Win + R, then typing “cmd”. Or just type “cmd” in the Start Menu search box.)

del /s /q /f /a .DS_STORE

That will find every instance of this Mac resource file and delete it. Good times. But wait there’s more. In addition to DS_STORE, OSX will also put a bunch of other junk every where starting with “._”. Kill those like this.

del /s /q /f /a ._.*

(Why not use “._*'” instead? Apparently, you can sweep up legit files from other things such as Chrome by doing that. Thanks commenters.)


Important note! This will only search inside the folder you’re in, as well as every folder below that. So, if you wanted to search and clean an entire drive, make sure you’re in the root folder. Get there with this:

cd \

You could also put all of this into a .bat file for great automation.

Pro tip: copy-pasting into your command window

Windows 10 will let you CTRL-V paste into the command line. Friggin sweet. But did you know you can do it in other versions of Windows too? Just right-click on the command window and click Paste. That will save you a little work.

41 thoughts on “Delete all hidden Mac junk files in Windows (Like .DS_STORE)

  1. Thanks for this.

    So if I want to remove the ._filename garbage that OSX scatters after every file open as well, would it be:

    del /s /q /f /a:h ._*


  2. this command is not working on my PC. it says: “Could Not Find C:\.DS_Store”. But there are lot of .DS_Store file accessing through Mac to Windows.

  3. Same here as mentioned by crowdyR – I get the same exact message (I am running a Windows 7 Ultimate OS). I know for a fact that I have at least 4 .DS_Store files as well.

  4. This has helped keep my sanity. I was able to delete 19,617 ._* and .DS_STORE files! (I know this amount because when I backup, I exclude all ._ files, yet I was not able to delete them from the source side) Thank you so much.

  5. I just tried it and it works! Thank you so much for this amazing tip! I heard some beeping sound though, twice. Wonder what that was.

  6. don’t do ._* as what to be deleted! you end up deleting a bunch of pref files for google chrome. the files you want deleted have ._. so make sure you add an extra . to ._ THAT’S WHY you had 19k files deleted! you deleted stuff you might have needed.

    stick to ._.* not ._* k good.

  7. We ran this cmd and have now lost every file. Did we do something wrong? The files don’t even show up in the “recycle bin”.

  8. It worked like a charm! Thank you. Of course you can use also cd if you want to clean only one folder:
    echo on
    cd F:\MP3\
    del /s /q /f /a:h ._*
    Here there are no limits to your fantasy 🙂

  9. the del /s /q /f /a:h ._* worked like a charm!!! just make sure you have selected the root folder for all the files you want deleted…win 8

  10. For those who still have .DS_Store files after running command, it is possible that the file is no longer hidden. Just remove the /a:h. I now have both commands in my batch file and it removes all. (del /s /q /f *.DS_STORE)

  11. I am really grateful for this-it did indeed work like a charm. However I do have some files which have the ~$ remainimg-any hel with that?

  12. instead of using /a:h which mean it require that the file has to have attribute hidden, use just /a instead, this would simply mean regardless of what the attribution the file has. This mean, the deletion command is better w/ just
    del /s /q /f /a .DS_STORE
    There is no need to do two separate commands.

    That said, I would prefer just ‘del /s /f /a .ds_store’ no quote. or maybe even add >sometextfile.txt to export the output instead to keep the log just incase you need that info later.

  13. Hi guys
    The command worked perfectly but now I have some empty folder that I can no longer delete and some I can no longer access.

    I need to remove the folders as well but nothing seem to be working
    any help please?

  14. My troubles running these stemmed from encoding issue. I was saving as UTF-8. Once I changed to ANSI it worked just fine. Maybe this is a given, but I was not aware…thanks for the post!

  15. Your wild cards do not match the latest Mac OSx Yosemite garbage HEAP. Use this:
    del /s /q /f /a:h *DS_STORE
    del /s /q /f /a:h ._*
    del /s /q /f *DS_STORE
    del /s /q /f ._*
    However, this does nothing to clean out zip or other compression archives.
    Is there a way to prosecute scum polluting the universe?

  16. These commands only work if the files are local. These folders like .AppleDouble, .Parent and .DS_STORE are hidden to Windows O.S. and can’t be seen with ATTRIB command. Once these folders are on a server they can’t be deleted by any method (Windows) I am aware of. I welcome any suggestion how to remove them. Thanks.

  17. When typing in terminal under OSX or DOSprompt under Windows, things can go pretty much wrong very fast. Look the one above typing *.* instead of *_.* and deleting all his files.
    Why don’t you guys just relax and use something like IXSOFT Folderwasher. Does the job nicely in OSX/Windows. No need of typing those DOS commands.
    And on Apple’s HTFS drives you can kill the clutter of thumbs.db that Windows splatters across Mac drives…
    Or ‘Dot Delete’ (Windows) or ‘DS_Store Cleaner’ or ‘DS_Store Remover’ (OSX)
    Those OSX users really angry at DS_store may look to:
    But this is not for the faint hearted.
    Be remembered that living in a mixed enviroment of OSX/Windows, there is always what Apple tells about preventing OSX from writing DS_store to network shares:
    Preventing the clutter from being produced may be better than cleaning it up daily.
    However this does not apply for USB drives – see the interesting comments at death-to-ds_store. Use ‘Finder Cleaner’ on OSX.
    And watch out using DOS del .DS_store commands on NTFS drives that have Mac-Install-files on them, like .dmg or .pks. Those may get corrupted and left unusable for the mac. Be sure to have just windooze stuff on them when hitting execute.

  18. I want to use this to rid my server of ._* files. My Macs and PCs share a Drobo 5N NAS as a file server. Tired of seeing these ghost when I am on server with PC.

  19. Found this with google and have a update for you:
    You don’t have to run the del with /a:h and without
    Just use /a (no :h) to match iles with all attributes

    You can easily verify by
    dir c:
    dir c: /a:h
    dir c: /a

  20. What command line would I use to delete the DS_Store files on an external hard drive? The ones in question are drive G: and drive F:. How would I write the command line for them?

  21. Thanks a lot for this. Very helpful. At first it wasn’t working for me, was getting the “couldn’t find” error, but realized it was because I had a:h in there when the files weren’t hidden for me. Changing the “a:h” to just “a” made the difference.

    **Steps I used in Windows 10**

    1. Navigate to directory you want to use this in
    2. Click address bar, COPY folder location (“C:\Users\yourname\Desktop\yourfolder” for example)
    3. Open CMD
    4. TYPE: cd
    5. CMD should show that you’re now in folder
    6. PASTE “del /s /q /f /a ._*”
    7. List of deleted files should appear.


Leave a Comment

Your email address will not be published.