Remove USB memory after deleting resource fork (the files starting with “. (dot)”) with dot_clean command

When share the data with USB memory between Mac and Windows, Windows users don’t like resource fork such as “.DS_Store”, “._xxx”, and so on. I was warned “Is your computer infected by virus?”. I want to remove resource fork using other’s USB memory.

You can find some apps to remove resource fork and remove disks. However, someone hesitate to use them because we don’t know what processes are performed. Recently, the app I used was not published and I find the convenient command “dot_clean”. So, I decided to make the app by myself.

dot_clean command

In Mac, there is a convenient command to remove resource fork, “dot_clean”. I didn’t know the command, although I have used mac for 10 years. When does it exist? See the following site about the detail of “dot_clean”.

on the terminal, run the following command.

> dot_clean .

All resource forks are deleted in the current directory and sub directories.

Make App with Automator

I’m reluctant to open terminal and type the command every time, I made an app with Automator.

Open Automator, and select application.

From the left column, drag and drop “run shell script”, “Get selected finder items”, “remove disk” into the right column.

For “run shell script”, select “as argument” in “Pass input”. Write the following code.

for f in "$@"
do
	dot_clean "$f"
done

When you select “as argument” in “Pass input”, the default code was inserted automatically. So you just change “echo” into “dot_clean”.

Save the app, and well done.

You can also change the icon.

Open the image file you want to use as icon with preview, and copy it with Ctrl-A + Ctrl-C. Right click on the app you made and choose “see information”. You can see the following window and left click on the upper left image. you can find the image file is surrounded by blue line, paste the image with “Ctrl-V”. Now you succeed to change the icon. I use FLATICON to find images.

It is convenient if you set the app into Dock or Desktop.

Summary

I descrived how to use “dot_clean” and make an app with Automator to remove resource fork (the files starting with “.(dot)”) before removing USB memory. It’s very easy and we can use it safely because I know what happens behind. Let’s try.