Automate Removal of Mac Double Files on Windows

Well, I haven’t found a way for Mac OS X Lion to clean up its double files (i.e. the ._ files that are created when actual files are created on a Windows share) so I have decided to tackle it from the Windows side. On my Windows Home Server 2011 box I have written a small PowerShell script to take care of the removal of the files on my DriveBender pooled storage volume.

So here is the script:

cd \
cd '.\ServerFolders\Downloads\Torrents - Started'
Get-ChildItem "._*.*" -Force | Remove-Item -Force

This script only clears out the offending files in one folder (i.e. the folder on the box which loads the torrents for downloads which jams when a Mac Double file appears) but you could extend it to traverse folders and then schedule it to run automatically (I have it running every minute and it only takes a few seconds to execute at most).

Bear in mind, you might need to change your PowerShell execution policy to run local unsigned scripts using the following PowerShell command:

Set-ExecutionPolicy RemoteSigned

This will turn off the requirement for local PowerShell scripts to be digitally signed while still enforcing remote scripting to check for a digital signature.

Hope this is handy!

1 comment

    • MJD on September 26, 2011 at 07:10
    • Reply

    I will have to do something similar in Linux to clean up my Mac droppings. 🙂

Leave a Reply

Your email address will not be published.