Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jobs, Steve

macrumors member
Original poster
Jul 26, 2014
37
3
Everytime I connect a usb pendrive/hdd, Finder, (or any other process) create some hidden files (._.DS... .trashes...)
Also when I copy a file from my Mac to usb drive, example Photo.jpg, a .Photo.jpg is created.

Is there a way to permanent disable the creation of ALL this hidden files to external usb drives??
I mean ALL external usb drives at all, not to set any single external drive to not create them.
 

thejasonhowell

macrumors regular
Nov 14, 2013
127
49
Peoria, Illinois
Everytime I connect a usb pendrive/hdd, Finder, (or any other process) create some hidden files (._.DS... .trashes...)
Also when I copy a file from my Mac to usb drive, example Photo.jpg, a .Photo.jpg is created.

Is there a way to permanent disable the creation of ALL this hidden files to external usb drives??
I mean ALL external usb drives at all, not to set any single external drive to not create them.

That's the nature of including Apple in your multiplatform setup
 

1024724

macrumors member
Apr 4, 2016
83
77
You can try this out. It may still include .fsevents, .DocumentRevisions, .TemporaryItems and .Trashes. I kind of think it may be unavoidable to create certain file system structures when introducing a volume. The Spotlight stuff and the .ds_stores you can take care of though. Try these out and see if they help. Probably best in the order their given but I really can't verify if it matters or not.

Prevent MDS from attempting to Index
sudo touch /Volumes/your volume name here/.metadata_never_index

Disable Indexing AND Searching of Volumes
sudo mdutil -i off -d /Volumes/your volume name here

Delete existing Spotlight Index
sudo rm -rfv /.Spotlight-V100

Disable creating '.ds_store' on USB volumes
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

Disable creating '.ds_store' on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

Sorry if this makes your machine explode, implode, hack NORAD, "Friends" you with Justin Bieber or any other unexpected results.
 

Jobs, Steve

macrumors member
Original poster
Jul 26, 2014
37
3
Thanks to grauenwölfe
I think I found a partial solution!

Using the commands:
Code:
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
Code:
sudo mdutil -i off -d /Volumes

no more .ds_store and no more ".example.jpg" when I copy "example.jpg" from mac to usb.

Even If I keep viewing hidden files with the command
Code:
defaults write com.apple.finder AppleShowAllFiles YES
no more .ds_store on Desktop, and no more on any folders.

so, thank you again I do NOT see .ds_store anymore, and best without using any external software.
 

dauber

macrumors regular
Jan 10, 2012
155
20
Chicago
Thanks to grauenwölfe
Code:
sudo mdutil -i off -d /Volumes

so, thank you again I do NOT see .ds_store anymore, and best without using any external software.

I found this thread when I was researching a problem I've been having since upgrading to Sierra in which files copied to a USB device (not storage) are rendered inoperable, and even removing the hidden files didn't help.

The command I quoted, though, gives me this error:

Error: invalid operation

Error: unknown indexing state.
 

1024724

macrumors member
Apr 4, 2016
83
77
dauber,

You have to enter it fully and correctly.
sudo mdutil -i off -d /Volumes/THEN YOU HAVE TO TYPE IN YOUR DRIVE NAME HERE

Some examples...
If your drive name is "dauber" then type in:
sudo mdutil -i off -d /Volumes/dauber

If i your drive name is "Dauber" then type in:
sudo mdutil -i off -d /Volumes/Dauber

If i your drive name has a space in it like "Macintosh HD" then type in:
sudo mdutil -i off -d /Volumes/Macintosh\ HD
 

dauber

macrumors regular
Jan 10, 2012
155
20
Chicago
Thanks. That solved the "unknown indexing state" problem, that but still didn't solve the problem of the file copied being rendered unusable. (And it still creates a "._Filename" file.)

And upon using Disk Utility, turns out this device is a FAT12 device. That probably has something to do with it...betcha Sierra doesn't support that format. :/

(FTR, the device I'm using is a pretty obscure thing....it's a rewritable cartridge for...ya ready?....Atari 7800: http://www.vectrex.hackermesh.org/index.php/en/mvbd-mvmc-3/faq-2 . I've been in contact with the developer, who himself just upgraded to Sierra. He hasn't found a solution yet other than using Windows...)
 

Lounge Deluxe

macrumors regular
Jun 1, 2009
152
20
Amsterdam
dauber,

You have to enter it fully and correctly.
sudo mdutil -i off -d /Volumes/THEN YOU HAVE TO TYPE IN YOUR DRIVE NAME HERE

Some examples...
If your drive name is "dauber" then type in:
sudo mdutil -i off -d /Volumes/dauber

If i your drive name is "Dauber" then type in:
sudo mdutil -i off -d /Volumes/Dauber

If i your drive name has a space in it like "Macintosh HD" then type in:
sudo mdutil -i off -d /Volumes/Macintosh\ HD

Hi I'm struggling with OneDrive and how to prevent .ds_store files to be automatically saved to OneDrive. OneDrive does not appear to be a Volume on OS X / MacOS but rather a folder inside wherever you have saved it to. How would I prevent .ds_store files from polluting OneDrive? Much appreciated,
 

jmpage2

macrumors 68040
Sep 14, 2007
3,224
549
I just encountered this issue myself, I view it as an issue because I can't understand what benefit these files have, can someone explain?

In my case I was copying a bunch of slides for viewing on a TV. The TV kept picking up the bogus files and complaining that they were corrupt and could not be displayed. I was a bit gobsmacked when I discovered that my Mac is creating these files simply by copying images from MacOS to a thumb drive.

Would love to understand the rationale behind this happening, is it related to spotlight indexing?
 

saeidk

macrumors newbie
Aug 7, 2023
1
0
Hello
acording to this guide:


Code:
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

I diasbled unnecassary hidden files, But now spotlight didnot work for me in anyway

this code:

Code:
sudo mdutil -i on /

didnot work for me It sows a bar and says indexing but nothing changes.

Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.