16

I'm looking for some way to configure OSX to prevent it creating .apdisk files and .TemporaryItems folders on network shares.

These are created any time OSX accesses a shared folder on the network.

In searching, some possible solutions I've found include:

  • Stop using the Application (Finder)
  • Mark the share(s) as read-only
  • Ignore them
  • Use 3rd party software (such as BlueHarvest) to remove the files.
  • Schedule a cron script to delete these files.

Unfortunately the first three options are not workable for me, and I'd rather not have to buy licences or schedule clean-ups on the file servers.

Is there a way to configure OSX not to create these in the first place?

(Finder is connecting via AFP to the network shares, for what it's worth)

Edit, approx 1 year later: Please note that I'm not looking for a cleanup solution.

BlueHarvest (if you have a mac to run it on), and scheduled cleanup scripts are fine - but less than ideal. I really need a solution which prevents OSX from creating these files in the first place.
At this point in time, it appears Apple don't provide such a configuration option which is disappointing.

3
  • What kind of server(s) are you connecting to? OS X or something else? Also, why don't you want the files - I'm guessing non mac clients on those shares? Commented Feb 18, 2014 at 9:07
  • All kinds of servers - it doesn't matter. And yes, I don't want them because of non-mac clients, and general pollution of the shares.
    – user10577
    Commented Feb 18, 2014 at 12:49
  • OK. I have the same problem but my solution is not within your parameters; I run dot_clean(1) from cron on the client(s) / suppress creation on the server. Commented Feb 18, 2014 at 16:12

5 Answers 5

5
  1. Open Terminal.
  2. Execute this command: defaults write com.apple.desktopservices DSDontWriteNetworkStores true
  3. Either restart the computer or log out and back in to the user account.

Reference: http://support.apple.com/kb/HT1629

2
  • 3
    Ah, unfortunately this only stops the .DS_Store files from being created, it doesn't stop .TemporaryItems folders and .APDisk files from being created.
    – user10577
    Commented Apr 10, 2013 at 1:17
  • #blameapple Nothing I can do. :(
    – jnovack
    Commented Feb 20, 2014 at 20:00
4

If you are running Windows file shares on Windows Server 2003 R2 and above, you can create file screens that prevent any user from creating any set of pre-specificied files.

I have effectively used this approach to eliminate all mac created files on our file shares.

Please see the MS Technet document, Screening Files, for more information.

1
  • Oh, wow - that's an interesting solution. Had no idea File Screens existed.
    – user10577
    Commented Mar 6, 2014 at 1:16
3

While this might not help everyone, if you are running samba on the file server, you can add the following in your smb.conf:

Veto files = /.TemporaryItems/._.TemporaryItems/.DS_Store/

The "Veto files" is a / separated string of filenames (wildcards also allowed) that is forbidden to be created. This resolved the issue for me.

I found this trick on the Arch Linux samba wiki

1
  • I used something similar some years ago, I had to disable it because some versions of MacOS X refused to connect to the share or had random problems with it (don't remember exactly, it was around 2010...). Not sure what happens with current versions.
    – Ale
    Commented Mar 30, 2015 at 22:06
2

BlueHarvest is probably the best and easiest way to maintain the network shares clean, at least that's what I went for after taking up most of your options myself.

After that is a cron job for deleting all of those files, using something like:

find "$@" \( -name ".DS_Store" -or -name ".TemporaryItems" -or -name ".Trashes" -or -name "._*" \) -exec rm -rf "{}" \; -prune 
3
  • BlueHarvest and a cronjob were both already mentioned as non-preferred ways of dealing with this.
    – user10577
    Commented Jan 17, 2014 at 5:35
  • Hi! I reckon you did mention that, but my answer served precisely the point of giving a recommendation from my previous (and current) experience. I still have BlueHarvest installed for achieving exactly what you need, having tried some other solutions similar to the ones you mentioned though none with the same success rate. I.e. it's still my best recommendation and in my pov worth the cost.
    – acseven
    Commented Feb 22, 2014 at 11:51
  • Thanks - I'm glad you find BlueHarvest valuable, and I'm sure others will find the script you've provided useful in scheduling cleanups. Neither meet the requirement of configuring OSX not to create them in the first place. BlueHarvest in particular, regardless of the price, is not useful for my situation - it would require the purchase of a mac, which isn't cost effective. Until Apple provide a configuration option to suppress this, the question will remain open.
    – user10577
    Commented Feb 22, 2014 at 15:53
0

sshfs has a noappledouble option that stops at least .Spotlight-V100 from being created in my (very limited) testing...

mkdir -p /Volumes/user && /usr/local/bin/sshfs \
    -o volname=user,local,cache=no,allow_root,noappledouble,defer_permissions,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
    [email protected]:/mnt/tank/homes/user \
    /Volumes/user

If using sshfs is an option you might consider this solution.

You must log in to answer this question.