Showing posts with label files. Show all posts
Showing posts with label files. Show all posts

Friday, June 30, 2017

Removing Mac index files on my X1000

One of my pet annoyances on the Apple Mac is the autocreation of thousands of ._blah index files for every file on your hard disk, cached by MacOS X.

How does this relate to my X1000? Well, when I copy my music and photos across from the Mac to the X1000 I end up with these really annoying files on my hard disk, which are not visible on a Mac but very visible on anything else.


These files get in the way when selecting a drawer for playing music in AmigaAmp or other music players, adding extra unusable files to my playlist when using the default filters. Also, these index files appear when selecting images for viewing and so on. I want them gone from my X1000!

Deleting them all individually is just not an option as there are thousands of them scattered in hundreds of drawers all over my hard disk!

But fortunately, help is at hand to solve this problem. Actually, thanks to some help from Severin (thanks mate) I have two ways that work under AmigaOS 4.1 Final Edition, depending on whether you have Dopus 5 installed under AmigaOS 4.1 Final Edition or not.

Let's start with the case that you don't have Dopus 5 installed on your X1000, as this probably applies to more people.

Open up a shell and pick a drawer that has some of the annoying files in it. For my test I used a Photogenics drawer. Don't run it across a whole partition or large drawer with lots of sub-drawers until you test it does what you expect!

I won't be held responsible for losing files on your hard disk from following this so please be careful. I recommend backing up first just in case.

The command I used is:

list <path> pat="._#?" all lformat "delete %P%N" to ram:script

What this does is takes the path you entered and matches recursively anything starting with ._ (which is what Mac index files start with), and then generating a delete command for each file and writing the full command to a file called script in RAM:

In my case for my first test I used the command below in the Shell:

list sys:Utilities/Photogenics5/ pat="._#?" all lformat "delete %P%N force" to ram:script

The resulting script file shows the deletions to be performed and the path too. You can review this to make sure nothing important has been picked up by mistake and remove it if it is.


The force is important as the ._ index files are read only files and they will not be removed without it under AmigaOS 4.1. You can then type in the following to perform the deletions:

execute ram:script 

Here is the example, and showing the clean drawer afterwards:


Neat huh! You can of course do this from the root of your hard disk partition to speed this up, but please be careful and check the script file carefully for anything important before running it.

The other option is using Directory Opus 5 if you have it installed under AmigaOS 4.1.

In my case I have the updated 5.82 Directory Opus 5 updated for AmigaOS 4.1. It was available on a website for download but no longer available there. You can get it from the wayback web archive though here if you want it. I looked at Dopus5 previously on this blog here, here and here. I even covered the toolbar icon functions here.

In any case, assuming Directory Opus 5 is installed and running, I need to turn on the Recursive filter so that Directory Opus applies the operation recursively. You can access this option from the Settings menu:


That done, I then locate a music drawer with heaps of these annoying files. I could select all drawers but initially I will test with a single one:


I then go back a drawer to select the drawer to delete:


I then select Delete from the menu as below, but don't panic - as long as Recursive Filter is selected it will prompt before deletion:


Here is the filter pattern prompt that then appears for the deletion - by default the filter #? deletes all files:


You need to change this to ._#? so it only removes the index files. If you leave it as the default it will remove all the files so please check you have this done before proceeding! Then click OK.


You will get one final confirmation before it deletes. I select Delete All, which deletes all the  ._#? files and leaves everything else.


Here is the clean resulting drawer with no more index files - fantastic!


I then did the same steps starting from the iTunes Music drawer I copied across, which removed all the ._ files throughout the whole structure recursively!

It is a useful tip that works well, and thought it might be useful to share with you all in case you are experiencing the same issue on your X1000 or other AmigaOS 4.1 system.