Awesometoast.com

Fixing stuff and maybe other things.

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.

Posted under: Fixing Stuff

41 comments ↓

#1 by Bob on 11.28.11 at 9:59 pm

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 by Toastmaster General on 11.29.11 at 10:36 am

It sure does! I just tested it.

#3 by crowdyR on 02.27.12 at 8:41 pm

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.

#4 by Michelle on 05.17.12 at 1:37 am

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.

#5 by Michelle on 05.17.12 at 1:37 am

…. Oh, but the “del /s /q /f /a:h ._*” command worked – Thanx 🙂

#6 by Andrew M on 05.21.12 at 6:51 pm

Thank you very much for this!

#7 by uau on 05.28.12 at 5:16 am

use:
del /s /q /f .DS_Store
and it will work.

#8 by Nathaniel Hirschler on 09.30.12 at 11:52 pm

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.

#9 by Toastmaster General on 10.01.12 at 9:31 am

19,617 — That’s definitely a lot. Very glad I could help!

#10 by peter on 11.04.12 at 9:31 am

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.

#11 by Paul on 11.17.12 at 2:22 am

Nice one!

#12 by Johnny on 12.05.12 at 1:00 am

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.

#13 by gmeben on 01.10.13 at 1:15 pm

I’m running Windows 7 and the comment left by @uau worked for me:
del /s /q /f .DS_Store

#14 by Jeremy on 03.18.13 at 9:13 am

Thanks this worked great

#15 by VW Golf Mk7 – SD Cards and Album Art « Haydn's Blog on 06.12.13 at 10:20 am

[…] you're on Windows, you can delete the files at the Command Prompt using the command below (obviously you'll need to change to the relevant drive letter […]

#16 by Tim on 06.19.13 at 11:49 am

Thanks for this. Was driving me crazy having all these random useless files showing up.

#17 by HCN on 06.19.13 at 9:13 pm

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”.

#18 by Stephen on 07.08.13 at 12:23 am

Awesome…Thanks a lot, this is exactly just what I need 😀

#19 by Lou on 10.18.13 at 4:22 am

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\
pause
del /s /q /f /a:h ._*
pause
Here there are no limits to your fantasy 🙂

#20 by vicrattlehead on 10.22.13 at 3:17 pm

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

#21 by Gary on 10.30.13 at 5:20 pm

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)

#22 by Malita on 11.13.13 at 8:21 pm

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?

#23 by Harish on 11.26.13 at 3:44 am

Good one, saved me hours of work 🙂

#24 by techunsupport on 01.12.14 at 9:25 pm

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.

#25 by iceman on 06.01.14 at 11:35 am

Why is it givingme an error that the drive i did could not find?

#26 by Vinc on 06.03.14 at 8:01 am

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?

#27 by harleyless on 06.22.14 at 12:31 pm

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!

#28 by Jerome on 07.09.14 at 8:25 pm

Thx a lot, those pesky OSX hidden files gone! (Also ._.DS_STORE 🙂 ) Cheers

#29 by G on 09.07.14 at 1:38 am

You guys are great…a sincere thank you for an ex mac user 🙂

#30 by L on 10.23.14 at 4:10 am

del /s /q /f /a:h ._* is the correct one for me (or without /a:h)

#31 by Mark on 11.04.14 at 8:59 pm

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?

#32 by Joel on 02.05.15 at 8:53 am

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.

#33 by Marik on 04.29.15 at 8:05 am

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:
https://www.aorensoftware.com/blog/2011/12/24/death-to-ds_store/
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:
https://support.apple.com/de-de/HT1629
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.

#34 by Marik on 04.29.15 at 8:13 am

Those wanting to have .DS_Store files deleted automatically when ejecting USB-media from OSX may look to:
http://hints.macworld.com/article.php?story=20110204124029798

#35 by Bob Nathans on 05.18.15 at 8:20 am

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.

#36 by Andreas on 07.03.15 at 6:34 am

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

#37 by Eduardo on 07.24.15 at 1:10 pm

I love you. Genius.
So simple…

#38 by Delete .DS_STORE | Ingrid Richter on 08.20.15 at 9:26 am

[…] http://awesometoast.com/delete-all-instances-of-ds_store-in-windows/ […]

#39 by Shadow on 02.21.16 at 1:29 am

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?

#40 by T on 08.16.16 at 6:42 pm

Hi,

How can I choose the root folder in the command window? or shoould I just type del /s /q /f /a .DS_STORE without designate the folder,,,

Thank you,,,

#41 by John on 08.17.16 at 11:15 am

I also have a drive named :N. I need to erase the file inside them.

Leave a Comment