Jump to content

[How To] Hide .DS_Store files in Windows


9 posts in this topic

Recommended Posts

OSX like other Unix systems creates a number of metadata files for things like fast indexing. The first character of these files and folders is always a period ie ".DS_Store" or "._MyDoc.doc" and from this file naming convention OSX from the knows to hide these files so they don't clutter up Finder. However Windows doesn't automatically hide these files and they are created whenever OSX browses a Windows drive with read permissions ie. through a networked drive with samba or using Macfuse with ntfs3g. You can tell OSX not to create these files but they are created for a reason and I would prefer to have them on my OSX drive. This tutorial will show you how to quickly and simply add an extra layer of invisibility to these files in Windows so that they will not show unless you check the "Hide protected operating system files" option in Explorer, an option I am content to leave on unless needed.

 

1. Create a new text document anywhere. Rename it to something suitable like "Hide DS_Store Files.bat" any name is fine as long as you change the extension from .txt to .bat If you get a prompt about changing the file extension choose 'yes' to rename it.

 

2. Right click on the file and select "Edit"

 

3. Paste the following code into the text editor, save and exit. If your windows installation is on a drive other than C:\ then replace C: with the appropriate drive name.

Attrib +h +s C:\*.DS_Store /s
  Exit

If you have multiple drives you would like to hide files on then create an entry for each. Likewise, if there are other file types you would like to hide, add entries for each:

Attrib +h +s C:\*.DS_Store /s
Attrib +h +s D:\*.DS_Store /s
Attrib +h +s C:\*._* /s
Attrib +h +s D:\*._* /s
  Exit

(WARNING* if you do something silly like "Attrib +h +s C:\*.* /s" don't complain to me when all of your files disappear *WARNING)

 

4. Double click on the .bat file to run the script, a command window will pop up. It might look like it isn't doing anything or has crashed, but don't worry. The script is searching every file on your C: drive for .DS_Store files to hide, this can take a long time.

 

5. New .DS_Store files might be created from time to time that won't be hidden any more. When this happens, just run the script again.

 

If you messed up and need to see the files you hid, in the Explorer menu bar, go to Tools - > Folder Options... in the box that pops up, click on the "View" tab and under the "Advanced Options" menu make sure the box next to "Hide protected operating system files(recommended)" is unchecked.

 

 

So what did we do?

"attrib" runs the DOS program attrib.exe which is used for changing file and folder attributes much in the same way that file permissions work in OSX.

 

This batch script tags all the .DS_Store files on the designated drive(s) with the Hidden "+h" and System "+s" attributes. This categorizes them as superhidden files and they will not show up in explorer or searches like regular hidden files and folders that have the "+h" attribute but are missing "+s".

 

* acts as a wildcard so "C:\*._*" will work on "C:\._MyDoc.doc" "C:\._YourDoc.doc" "C:\DoNotHide._" "C:\DoNotHide._MyDoc.doc" etc...

 

the "/s" command at the end tells the script to perform the attribute change on all the subfolders in C:\ so it will look in "C:\", "C:\Windows", "C:\My Documents", "C:\Program Files", etc. and all the folders in those folders. In effect, it checks every single file and folder on the C:\ drive.

Link to comment
Share on other sites

Hey dude.

 

I use BlueHarvest for this Job.

This tool deletes all these files automatically and you can set a lot of preferences!

 

I read about BlueHarvest when researching a fix for this. I prefer my method for a # of reasons:

 

1. It does not delete any files and all those changed are still completely accessible to both operating systems.

 

2. It is a fast working single use script that takes no longer to run than changing file sharing attributes for an entire drive. File attributes remain persistent even if OSX makes changes to .DS_Store files. In comparison Blue Harvest runs as a daemon in the background eating up CPU and memory resources and might also degrade disk transfer speeds as well.

 

3. Blue Harvest costs $13. This solution is completely free and can be completed in the time it takes to dig your credit card out of your wallet and pay for their software.

 

It might be a nice solution for IT admins and people working on systems they don't own but for the casual dual-boot user I'd suggest they try this method before shelling out money for software they may not need.

Link to comment
Share on other sites

  • 9 months later...

Hi..

 

i just wrote a small script.

 

Works on Windows 7. Untested on older system.. Should work if attrib command has /S parameter (proceed subfolders)

@echo off
for %%A in (C: D: E:) do (
echo Cleaning drive %%A from resource forks
attrib +H +S %%A\._* /S
echo Cleaning drive %%A from DS_Store files
attrib +H +S %%A\.DS_Store* /S
)


pause

Link to comment
Share on other sites

  • 1 month later...
1. Create a new text document... like "Hide DS_Store Files.bat"

 

3. Paste the following code into the text editor:

Attrib +h +s C:\*.DS_Store /s
Attrib +h +s C:\*._* /s
Exit

4. Double click on the .bat file to run the script

 

Thank you! Exactly what I was looking for. I can't believe how badly the Mac OS behaves when dual booting or using NTFS drives. All that unnecessary clutter.

 

I did have trouble with one file, called "._." at the top level of my NTFS drive on my dual boot Hackintosh. WinXP complains "Cannot delete file: Cannot read from the source file or disk." Searches elsewhere suggested the drive might be corrupted, but disk check found nothing wrong. Can't delete, edit, or rename that file, and your script generated an error when trying to change the permissions. Any ideas?

Link to comment
Share on other sites

Another problem: there are still lots of "Icon\r" and ".Icon\r" files that are visible in Windows. I've tried matching using ".Icon?" and ".Icon*" but neither works. In a DOS command window, I tried both, with the same result. (Didn't include the /s to avoid going through the whole drive.)

 

D:\>Attrib +h +s D:\.Icon*
Unable to change attribute - D:\.Icon

D:\>

Any suggestions? Thanks in advance!

Link to comment
Share on other sites

  • 7 months later...
Attrib +h +s C:\*.DS_Store /s
  Exit

If you have multiple drives you would like to hide files on then create an entry for each. Likewise, if there are other file types you would like to hide, add entries for each:

Attrib +h +s C:\*.DS_Store /s
Attrib +h +s D:\*.DS_Store /s
Attrib +h +s C:\*._* /s
Attrib +h +s D:\*._* /s
  Exit

 

Great solution! I just added another line of code to also hide some inconvenient folders such as .Trash, .Spotlight etc.

 

Attrib +h +s D:\*.DS_Store /s
Attrib +h +s D:\*._* /s
Attrib +h +s D:\.* /s /d
  Exit

The additional parameter /d needs to be used together with /s to process folders as well.

Link to comment
Share on other sites

  • 2 weeks later...
  • 8 months later...

Hi Guys, thanks for great solutions..

 

i create a batch file that hide all mac cache files , in windows drives.( attached file.)

 

Attrib +h +s \*.DS_Store /s
Attrib +h +s \._.* /s
Attrib +h +s \*.fuse* /s
Attrib +h +s \*.donotpresent /s
Attrib +h +s \*.fseventsd /s
Attrib +h +s .fseventsd
Attrib +h +s .Trashes
Attrib +h +s .TemporaryItems
Attrib +h +s \*.TemporaryItems /s

 

if you wana do manually, create a text file, copy this commands, paste into the text file.

save as " HideExtensions.bat " .

run this batch file in every hard disk drive partitions.

 

for example, copy this file in c: partition , and run it for hide files on drive c:

for partition d: , run it on this partition , and for all partitions.

 

GOOD LUCK!

Hide_Mac_CacheFiles.zip

Link to comment
Share on other sites

 Share

×
×
  • Create New...