How do I prevent ._ file creation?

Discussion in 'Networking & Compatibility' started by today, Feb 5, 2003.

  1. today

    today Registered

    Joined:
    Feb 5, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I have several Samba (ie, Windows-style) shares on our network. The Macs on our network can finally access them under OSX, which is cool, but they litter them with all sorts of "._blahblah" files.

    I need to turn this off. It is creating all these tiny files, each of which consumes 4k, which is the smallest block size on these particular Unix boxes. It starts to add up on shares with 80,000 files on them (they could consume 328MB!).

    What's odd is that the Macs obviously don't need these strange files at all. They work just fine on shares without write permissions (and thus, without the ability to create the "._" mess). I'm not sure why they don't come from the factory as good network citizens and have this stuff off by default on non-Mac shares...

    -todd-
     
  2. Pengu

    Pengu Digital Music Pimp

    Joined:
    Nov 17, 2002
    Messages:
    1,593
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Part Time Student, Full Time Digital Music Pimp.
    Location:
    Um.. Here.
    Uh..
    the ._ files are where osx puts the resource fork of a file if it's not on a HFS or HFS+ volume, eg, UFS, or Fat16/32 or NTFS (or any of the linux file systems) Only way to not have these on a non HFS file system is to not have resource forks, which isn't hard with files. they SHOULD be created without them. if you gives files a different application to open with than the system setting, or if images have a thumbnail of themselves as the icon, etc, that will require a resource fork.
     
  3. today

    today Registered

    Joined:
    Feb 5, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    They should, but they aren't. The Macs create them for EVERYTHING. MP3 files, text files, SourceSafe (Windows Version Control for Developers) files (!!!). It makes them for directories. It adds temporary item folders and trash folders.

    I just tried making the Samba server reject all attempts to make files that begin with "._". Know how the Mac responded to a simple drop&drag copy of a file named "test.rc" (a simple text file)? The Mac made a zero length file called "test.rc" then complained that there was some error about permissions and gave up! Thinking that this might be due to test.rc already having some resource fork attached, I copied a log file from a Samba share (this log file was created by a PC and this share had been previously stripped of all "._" files by hand) to the Mac desktop, then tried copying right back to another Samba share. BZZZZT!!! Same problem as mentioned above. So it is true that the Mac Finder *ALWAYS* makes a "._" file for EVERY file copied to a Samba share, regardless of whether it has a resource fork attached or not. Either that, or the Mac Finder always makes a resource fork for EVERY file, which would end with the same results on the network share.

    When I drag MP3 files and text files from Windows to the Samba share, all I get is an MP3 file or a text file. No extra files. I heard some Mac guy crack about the Thumbs.db files that Windows creates. I agree those are silly, but at least they are only created in response to a thumbnail browse operation, and are not created simply by the act of copying files to a network share. Plus, there is only one of them per directory, so it keeps slack space down. And, most importantly, you can EASILY TURN THIS FEATURE OFF!

    There is absolutely no reason why the Macs should be creating these extra resource fork files. All the files in questions are just data files. And on a server with a cluster size of 4k, they create a ton of wasted slack space.

    This is pretty frustrating. Thanks for reading my rant.

    -todd-
     
  4. jeb1138

    jeb1138 Carioca

    Joined:
    Sep 25, 2001
    Messages:
    460
    Likes Received:
    0
    Trophy Points:
    0
    Lol! No problem todd, hope it made you feel better! ;)

    If it makes you feel better yet, Apple is moving away from resource forks in order to make OS X a better 'Net Citizen'. From Apple's Mac OS X System Overview:
    It's gonna take a little time for backward-compatibility's sake though. And perhaps they'll never move completely away from extra forks, for the reasons that Pengu mentioned.

    Anyway, as far as current solutions for your problem, how about:
    1. Set up a cron job to get rid of them every once in a while. The Mac's only create a ._ duplicate file when they modify/create a file, right? How many files are your Mac users realistically going to modify/create before you can send the cron job around? What kind of network services are you providing? Is 4,000 reasonable? Is 16MB really that big of a deal? Is that even $0.10 worth of disk space?

    2. I'm not sure, but telling your Mac users to use RBrowser Lite to access the Network drive might solve your problem. RBrowser Lite does ftp & etc but it also works great as just a local file browser, and it's free. After the drive is mounted they can access it just like they would in the Finder. I'm not sure how it copies files around so I'm not sure if it would cause the same problem. Using the 'cp' command in the terminal, for example, doesn't create ._ files, I believe.

    I know what you mean about the waste of space and the fact that OS X should be a better network citizen in this regard, but given the fact that they Apple is working toward what you want (better network citizenship) it's not really that big of a deal to cope with it for the time being, is it? I guess I've never worked with a LAN where my users might be writing to over 10,000 files on the network though, so I guess I can't judge ya. :)

    Good luck.
     
  5. Pengu

    Pengu Digital Music Pimp

    Joined:
    Nov 17, 2002
    Messages:
    1,593
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Part Time Student, Full Time Digital Music Pimp.
    Location:
    Um.. Here.
    cp doesn't can't copy the resource fork as such... If you copy a file with a resouce fork from a HFS volume (where there will be no ._file) to a non-HFS volume using "cp" you will lose the resource fork.
    If you do it with the Finder, it will create the ._filename data file to store the resource fork data in.
     
  6. jeb1138

    jeb1138 Carioca

    Joined:
    Sep 25, 2001
    Messages:
    460
    Likes Received:
    0
    Trophy Points:
    0
    Which is exactly why I said something (maybe RBrowser but I'm not sure) using cp could be good for this situation. :) Nothing really essential is stored in resource forks these days anyway, is it?
     
  7. today

    today Registered

    Joined:
    Feb 5, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I suppose that is what I'll have to do. I don't know, somehow, this issue has really been a burr up my bum. Doing this sort of hack is frustrating, because I hear the propaganda about Macs having lower TCO. Well, that hasn't been my experience, at least with Unix based servers using free software tools.

    When I was running NT and Win2k based Servers, there weren't any issues with the Macs because Microsoft had done an absolute awesome job on their AppleTalk filesharing system. It allowed seamless filesharing between the two worlds while dealing with the resource fork silliness in the proper manner. IE, exposed to Macs, completely invisible to the PCs. It was possible to look at the resource fork on the Server, but even there, it required command-line tools. That's how hidden it was.

    I got tired of paying the Microsoft server user tax, so I went to OpenBSD. In Unix land, the AppleTalk stuff is about where Samba was back in 1995. No disrespect to the developers of netatalk, etc, it is just that Samba is pretty highly polished because they have more developers interested in working on that problem. And even netatalk litters the directories with .Apple* and similar stuff, although it is mostly concentrated in one subfolder. It is also separate from Samba, so I can turn the Samba VETO command on dot files.

    I guess I'm veering waaaaay off topic here. It is just as an admin, I've never really found the Mac to play well with others unless a Microsoft server was invovled in the transaction. That's why I never understand the TCO arguments.
    Well, yes, that is what I thought, although I've caught an entire subtree that *shouldn't* have been written by any Macs which had all these ._ files in them. Either there is some tool within the Finder that is doing this, or some Mac user of mine accidentally move the entire tree to his drive, then moved it back when they realized the mistake.
    No, you are right. My late night frustration after I had changed all the Samba servers to VETO ._ files and then finding it to not work caused me to go a bit hyperbolic.
    Thanks for the tip, I'll pass it to the Mac people.

    -todd-
     
  8. michaelsanford

    michaelsanford Translator, Web Developer

    Joined:
    Oct 7, 2002
    Messages:
    2,277
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Translator & Web Developer
    Location:
    Ottawa/Montréal
    The one-liner, run from the folder you want to clean (also suitable for cron, change the "." to the volume's path):
    find . -name ._* -exec rm '{}' ';'
     
  9. Didier Guillion

    Didier Guillion Registered

    Joined:
    Mar 24, 2003
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I had the same problem and here is what I did:
    instead of using a Server on the Windows side.
    I published the "Public" folder of my user's account on Mac OS X (X.2.4) and the Mac act now as a Samba server. I connected the PC as a client and there is no extra files added.

    Please note : in your Mac OS X account setup you ought to enable the Window access.

    Hope this help.

    Best regards
     
  10. liltylady

    liltylady Registered

    Joined:
    Oct 12, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    My mac osx is making ._ files on my external hard drive and my media player is picking them up and I have to scroll through the whole alphabet to view my "real" files.

    Is there anyone that can help with this - it is driving me bonkers.

    Please help.
     
  11. Satcomer

    Satcomer In Geostationary Orbit

    Joined:
    Jul 16, 2002
    Messages:
    9,144
    Likes Received:
    10
    Trophy Points:
    38
    Occupation:
    Looking toward the sky
    Location:
    Finger Lakes Region
    Download the free application TinkerTool are checkmark the box for not creating this files over a network.
     
  12. Giaguara

    Giaguara Chmod 760 Staff Member Mod

    Joined:
    Nov 29, 2002
    Messages:
    9,521
    Likes Received:
    11
    Trophy Points:
    38
    Or http://support.apple.com/kb/HT1629

    And a bit more about the resource forks http://lowendmac.com/crews/06/0104.html
     
  13. diannet

    diannet Registered

    Joined:
    Oct 23, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi everyone,
    All the solutions that people give to this problem seem to be on the Mac side.
    I'm finding that the ._ files only appear for the first time on a Windows XP machine with files I've just copied from a USB external hard drive or stick. The USB stick contains files I've backed up from my iMac and are carrying with me to use elsewhere. So here I am 3,000 miles from home with the USB stick, no way to "reprogram my iMac" and I have nearly half a gig of junk taking up valuable virtual memory space needed to run modern programs by the old Windows laptop I'm borrowing. I started opening every folder and sub folder and sub sub folder selecting and deleting the ._ but after a couple of hours I'd only chucked 250 MB worth, with thousands left to find and delete, and a numb mouse hand! I tried using Search to pull them up but it did not work.

    So, question is: any way to get rid of all these ._files on the Windows machine without having access to the original Mac?
     

Share This Page