[SOLVED] Prevent hidden files creation on usb drives

Discussion in 'macOS Sierra (10.12)' started by Jobs, Steve, Dec 16, 2016.

  1. Jobs, Steve macrumors member

    Jobs, Steve

    Joined:
    Jul 26, 2014
    #1
    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.
     
  2. thejasonhowell macrumors regular

    thejasonhowell

    Joined:
    Nov 14, 2013
    Location:
    Charleston, Ill
    #2
    That's the nature of including Apple in your multiplatform setup
     
  3. Jobs, Steve thread starter macrumors member

    Jobs, Steve

    Joined:
    Jul 26, 2014
    #3
    so there is no way to prevent that even on external drives??
     
  4. Jobs, Steve thread starter macrumors member

    Jobs, Steve

    Joined:
    Jul 26, 2014
    #5
    thank you for the noticed me about it, but I prefer to prevent the creation of theese files on external drives instead of delete everytime after creation.
     
  5. T'hain Esh Kelch macrumors 601

    T'hain Esh Kelch

    Joined:
    Aug 5, 2001
    Location:
    Denmark
    #6
    You can't. Unless you want Finder not to use them.
     
  6. Ulenspiegel, Dec 16, 2016
    Last edited: Dec 16, 2016

    Ulenspiegel macrumors 68030

    Ulenspiegel

    Joined:
    Nov 8, 2014
    Location:
    Land of Flanders and Elsewhere
    #7
    +1.
    There a number of apps that address this issue, but as was mentioned earlier they delete "junk" that has been already created. I tried some of them and was not satisfied at all as sometimes they do less, other times they do more than needed.
     
  7. 1024724 macrumors member

    1024724

    Joined:
    Apr 4, 2016
    #8
    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.
     
  8. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #9
  9. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #10
    Nope... like others mentioned, your best option is just to use one of the many utilities around for this. I like USBClean.
     
  10. Jobs, Steve thread starter macrumors member

    Jobs, Steve

    Joined:
    Jul 26, 2014
    #11
    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.
     
  11. dauber macrumors regular

    dauber

    Joined:
    Jan 10, 2012
    Location:
    Chicago
    #12
    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:

     
  12. 1024724 macrumors member

    1024724

    Joined:
    Apr 4, 2016
    #13
    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
     
  13. dauber macrumors regular

    dauber

    Joined:
    Jan 10, 2012
    Location:
    Chicago
    #14
    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...)
     

Share This Page