55

At work we're letting one of our very tech savvy clients actually help out a little with a few development projects specific to him. However, he uses his own personal Macbook, and as he edits files on our (Windows) networks, his Macbook always creates a bunch of unnecessary meta files that we end up deleting later.

For instance, it creates a file called .DS_Store in any directory he opens, as well as "dot underscore" files for each file he edits. So for instance, if he's editing a file called "Main.php", his Macbook will create another file called "._Main.php".

I know there are ways to prevent creation of .DS_Store files, but none about how to prevent creation of these hidden files prefixed with dot underscore.

Is there any way to turn that off on Macs? Any way to prevent it from creating those files in the first place?

hippietrail
  • 4,605
soapergem
  • 1,828

9 Answers9

19

On Linux file servers or NAS devices you can use the following:

Option A. Samba configuration modification preventing both resource shares and .DS_Store files:

veto files = /._*/.DS_Store/

delete veto files = yes

(Configuration file located at /etc/samba/smb.conf or /etc/smb.conf depending on your distribution) Disadvantages: not all shares are provided by Linux-driven NAS systems, or on most you don't have shell access.

Option B. Create a simple shell script and run it from one of your connected machines using cron.

find /YourNetworkShareLocation -name '._*' -exec rm {} \;

Replace /YourNetworkShareLocation with where your network share is mounted, e.g. /Volumes/ShareName or /media/ShareName, etc.

Disadvantages: this is the brute's way - unnecessary load on both storage and network. However, the same can be easily done in Windows using a little PowerShell magic.

Disclaimer: This is not what I call "a solution", it's a hack. But it could help someone reduce the annoyance levels delivered by resource fork files.

Milen
  • 605
5

Use a program other than Finder such as MuCommander to browse your files. (works on Local drives too).

In OS X lion, this method should allow default access to ~/Library without modifying settings or hitting ALT as well.

I use MuCommander on Snow Leopard and Lion and noticed that neither HFS+ or ExtFat volumes end up littered with files with these files.

Folks: there is another issue, File size... many of the resource forks at are least 4096 bytes even when the original file is under 4096 bytes so eliminating this problem does help with File System Bloat.

(For example: Download the Text file: http://www.gamers.org/pub/games/idgames/levels/heretic/g-i/horror.txt on a Mac and see for yourself)

Ofiris
  • 1,997
Marz
  • 51
4

Have him look into the free and aptly-named Cleanup SMB Mess application. The developer says:

This applescript droplet will clean up Windows shares mounted through the Mac OS X samba client, by removing all "._*" files, .DS_Store files and .Trashes folders on all the volumes and folders dragged on it."

I've only used with thumb drives and MP3 players, and it does what it says it does. I'm guessing it has to scan the device to remove the garbage, and that may be cumbersome on a large network share. But that's only speculation on my part. I'd suggest asking the developer.

JRobert
  • 7,134
2

If you want to just manually remove those ._ files there's no need for external utilities or complicated find commands. In your terminal, just run

dot_clean /path/to/where/you/want/to/clean

Note that this is recursive, so you don't need to go into subdirectories manually.

You could even set up a cron task to automate this. In your terminal, run

crontab -e

Then in opened editor put in this and save:

0 0 * * * dot_clean /path/to/where/you/want/to/clean

This will automatically run every day at 00:00. Check out https://crontab.guru/ if you want to know how to construct a cron task.

2

You could also use a Mac app in the app store called 'Annoying File Be-Gone' that runs on the menubar and works well.

Phil
  • 21
  • 1
0

On my QNAP NAS, the samba config in /etc/smb.conf already contained this:

veto files = /.AppleDB/.AppleDouble/.AppleDesktop/:2eDS_Store/Network Trash Folder/Temporary Items/TheVolumeSettingsFolder/.@__thumb/.@__desc/:2e*/.@__qini/.Qsync/.@upload_cache/.qsync/.qsync_sn/.@qsys/.digest/
    delete veto files = yes

so I edited the veto files line to:

veto files = /._*/.AppleDB/.AppleDouble/.AppleDesktop/:2eDS_Store/Network Trash Folder/Temporary Items/TheVolumeSettingsFolder/.@__thumb/.@__desc/:2e*/.@__qini/.Qsync/.@upload_cache/.qsync/.qsync_sn/.@qsys/.digest/

and then restarted samba (it's a primitive linux system so I did it via init.d):

/etc/init.d/smb.sh restart
-1

http://support.apple.com/kb/ht1629

You could also try using TinkerTool (http://www.bresink.com/osx/TinkerTool.html) - it used to expose this setting.

immutabl
  • 1,846
  • 6
  • 23
  • 33
-1

there is utility called "asepsis"

it is also has feature to clean your mac from .DS_Store files and so on read the FAQ

http://asepsis.binaryage.com/

-3

This is really easy and you don't need to install anything.

  1. Open Spotlight (cmd+space)
  2. Type in 'Terminal.App'
  3. And press enter (This should open the Terminal application)
  4. Copy this to your clipbpoard (cmd+c):

    defaults write com.apple.desktopservices DSDontWriteNetworkStores true

  5. and paste it into the terminal (cmd+p)

  6. press enter
  7. close the terminal (cmd+Q)
  8. Next time you restart finder, your Mac will stop writing DS files on network storage.

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