You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Is there a definitive way to prevent creation of "._file name" on network volumes?

I work with Blender and other software for which I distribute renders between my Mac and my PC. My main machine is a Mac Studio, but I will work on a project in Blender, send the project file to my PC and render there so I can keep working on something else on my Mac.


Well, I'm beyond sick and tired of seeing the creation of these duplicate files that start with "._" on the PC. In this case, they are the names of my projects, also with the .blend extension, that if I click on by accident, it launches Blender and then closes it a second later when it realizes it's not a real file.


Sure, I don't see these on the Finder, but I see them on the Windows File Explorer, and they make everything messy. They also creep their way onto optical media, so even though I bought an expensive external Blu-ray burner for my Mac, I cannot use it to burn data BD-Rs that are not simple file backups but instead Hi-Res music files that I buy on HD Tracks because those stupid "._" files will creep up everywhere. I have to transfer the whole tree I want to burn to the PC via LAN, go folder by folder to delete all the instances of "._" files and then burn. Having a Mac is supposed to make things easier, not unnecessarily complicated.


Now, for years I've been searching online for methods to stop macOS from creating these pointless files on network volumes, read all about it, how it's macOS metadata (well, I couldn't care less, since when they go to a network volume that metadata is useless in Windows), and there's a command that you can find on a thousand websites, that is completely useless:


defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true


Never did anything. Been trying that for the last 14 years I think. Nothing.


So what is the way, if there's a way, to not delete, I know how to do that, but to simply tell macOS to not create them in the first place? At least when the volume is mounted via SMB, because if it writes these files to one of my other Macs on the LAN I don't care because I don't see them. But when they go to Windows, I do see them, and after years of this, they are beyond annoying.


Is there a way to get rid of these for once and for all? At least until I wipe my Mac's internal drive to install the next major version of macOS, then I can run it again. But once a year is fine, especially if it works.



Mac Studio, macOS 14.7

Posted on Nov 1, 2024 9:03 PM

Reply
10 replies

Nov 4, 2024 3:58 AM in response to RobFocus

Neither of the two were full commands.

dot_clean requires the path to the folder you wish to clean.

dot_clean -m /Volumes/sharename

If you have the same volumes you are always using, you could create a Shortcut to run the command on those volumes and then eject them:

You would make a shortcut that runs a shell script with this:

dot_clean -m /Volumes/VolumeName
diskutil -eject /Volumes/VolumeName

ditto is a copying utility in the command line. If you use ditto --norsrc, the resource forks are not copied, so no metadata is copied.

For any command line utility, you can use man <command> to learn about usage.

man dot_clean
man ditto
I'm not going to use the Terminal to copy files all the time, I use the Terminal only when I have to.

Well, that's the only way to prevent writing the metadata to an unaware file system. You have to post-clean or not write them when you copy. ditto can likely be wrapped up in a Shortcut as I did with dot_clean.

Nov 2, 2024 5:04 AM in response to RobFocus

there's a command that you can find on a thousand websites, that is completely useless:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

Never did anything.

It isn’t meant to stop the metadata. The DS refers to .DS_Store. Why anyone claimed it stopped the writing of metadata I don’t know.

Is there a way to get rid of these for once and for all? At least until I wipe my Mac's internal drive to install the next major version of macOS, then I can run it again. But once a year is fine, especially if it works.

No, you can’t prevent writing. You can use dot_clean -m to recursively remove them, but I’ve never run it on a network Share.


Or, don’t use Finder to transfer the files. You can use ditto -norsrc

Nov 3, 2024 8:05 AM in response to RobFocus

The only such solution I know of is BlueHarvest. It prevents the Mac from writing .DS_Store, and ._xxx AppleDouble files from being written to non-Apple systems, such as Linux servers, or Microsoft formatted drives (ExFAT, FAT32).


You can set up its preferences to automatically keep drives you select clean of such files. It can also clean such drives that already have .xxx files on them.


It has a 30 day trial so you can test to see if it will do what you expect.

Nov 3, 2024 12:42 PM in response to Kurt Lang

I thought BlueHarvest was dead. Apparently, it's not dead, yet.


BlueHarvest doesn't prevent writing the files. All it does is clean them up automatically which is pretty close to preventing them. Nothing wrong with the app, it just doesn't prevent writing the files. There are people who want to prevent writing, not clean up the detritus.

There is no way to stop macOS from writing the files short of not using the Finder to write the files (or manipulate folder view--.DS_Store). It is possible to prevent .DS_Store on SMB network shares (previously posted defaults command), but I'm not sure about external drives.


I so rarely use that type of media anymore, I don't have any use for BlueHarvest. I just created a Shortcut to clean the flash drives. Now that Prusa has a network transfer option, I really have no need for the shortcut.

Nov 3, 2024 12:48 PM in response to Barney-15E

BlueHarvest doesn't prevent writing the files. All it does is clean them up automatically which is pretty close to preventing them.

I couldn't quite be sure. The preference setup makes it sound like you can prevent such files from being written. Or, maybe what they meant is it watches your tagged volumes for such entries and then removes them without being prompted.


But reading it again, yes, your entries are only there for manual cleaning. You select a volume in your list, then choose the menu to Clean using BlueHarvest.


Which makes purchasing the app somewhat pointless. You can do the same cleaning yourself in Terminal, which is likely what BlueHarvest runs in the background.

Nov 3, 2024 12:52 PM in response to Kurt Lang

Which makes purchasing the app somewhat pointless. You can do the same cleaning yourself in Terminal, which is likely what BlueHarvest runs in the background.

I have always thought the same, but reading through their FAQ, they offer a lot of cross-platform cleanup options, so can see where it would be useful to people who have to deal with all the different operating systems on a regular basis.

Nov 3, 2024 7:54 PM in response to Barney-15E

Thanks for the tip about that app. My only concern is that anything monitoring file activity is going to slow down transfers, and while I work only with SSDs, when it comes to transfers over the LAN using SMB, it's not as fast as transfers between SSDs connected to the Mac.


BTW, that command "dot_clean -m" doesn't work for me. Obviously I try it when I have the Terminal open in the SMB drive I mount almost all the time. It gives me this:


"usage: dot_clean  [-fmnpsv] [--keep=[mostrecent|dotbar|native]] [directory ...]"

Nov 4, 2024 12:38 AM in response to RobFocus

RobFocus wrote:

that command "dot_clean -m" doesn't work for me. Obviously I try it when I have the Terminal open in the SMB drive I mount almost all the time. It gives me this:

"usage: dot_clean  [-fmnpsv] [--keep=[mostrecent|dotbar|native]] [directory ...]"


Copy and paste (without [folder path]) the following command to the Terminal window and type a space to the end, and drag the USB drive (or a network folder) to the end, and press Return. Then eject the USB drive without opening it in the Finder (so new dot files are not generated).


dot_clean -mnf [folder path]


That deletes the '._' dot files that carry some Mac-specific extended file attributes that Windows does not understand (and are usually not needed anyway).


In the past I made an Automator app to do that but some macOS update broke it so I have used the Terminal instead.

Nov 5, 2024 3:53 AM in response to Barney-15E

OK first of all, to the admins, please realize that the way this forum works is rather confusing and very inefficient. If I can't reply directly to a specific post, but just to the thread in general (please correct me if I'm wrong), then it's not a conversation, it's a mess. And it's much more of a mess because by default, the replies to the OT are sorted by rank, which I don't even know what it is, but you start reading a thread and replies are not organized in a way that makes sense most of the time. So the user has to manually sort by date oldest so it resembles a conversation, but that won't make it clear every single time, because there's no hierarchy in the conversation.


Also, typing this on Safari in macOS Sonoma, all current versions, I can't scroll up the page because it keeps bouncing like crazy as soon as I move the wheel up. I can only scroll this text box I'm typing in.


So rather than delete my post, please take this as constructive criticism, which is what it is.


Now, in reply to Barney-15's latest reply, thanks for the details, I will copy and paste the to have as reference. But I will probably set up that shortcut without the eject, because at least when I'm working on a Blender project I have that Windows volume mounted all the time, and I copy files back and forth very often.


My main annoyance comes when I copied a new version of the project, and it creates one of those "._" dupes that are visible in Windows, so over time those turn out to be a lot and confusing, because if at least it put that at the end, it would change the extension, but the extension remains the same.


Regardless, that BlueHarvest program works quite nicely, just a right click on the SMB share, Services, Clean with Blueharvest, and all those pointless files are gone.

Is there a definitive way to prevent creation of "._file name" on network volumes?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.