How to find hidden files with the name ._*

How to find hidden files with the name .*? This command can remove these hidden files:
[i]dot_clean – Merge .
* files with corresponding native files.[/i]
How can I find it in a FolderItem?.

Those are the old-style Apple Double files used when storing FinderInfo, Extended Attributes/ACLs, and ResourceForks on non-HFS+ file systems.

Are you looking to ignore them, delete them, or merge them?

I worked at Apple France when MacOS 6 was released and I never heard anything about that. Was that in version 5 ? (or ?)

Of course on 68000 (not PowerPC nor Intel).

If you plugin a USB stick with a DOS/Windows partition to your mac, these files are created. If you eject this USB stick from you your mac and plugin to a Widows or Linux system, than you can see all these files.

Example:
macOS
MySpecialSong.mp3

Windows/Linux
._MySpecialSong.mp3
MySpecialSong.mp3

For this example:
If you would play all files on this USB stick on any device, you got the error message “Can’t play ###, because it is an invalid file”.

With the macOS commandline “dot_clean” I can merge these files, but I can’t see the files in a Xojo FolderItem.

This is not related to macOS, but to Windows who creates (like macOS) a plethora of invisible files.

I do not understand what you meant here.

Your solution is to exclude invisible files (if the file name starts with a dot, do not try to read it, even if its extension is mp3 or whatever).

BTW: don’t you know that Windows users are champions in changing the file extension (different problem) ?

I just checked: an mp3 file (here, one file), started with “ID3”. You can also check that magic value (if this is always the case) before loading a file contents.

This is also for anything else (gif for a gif, png for a png, rar for an archive, zip too…)

Hello,
you could use a shell to get the list of files. Something like this:

[code]var shellResult as String
var the_Shell as new Shell
var FileList() as String
var the_Folder as Folderitem

the_Folder = New FolderItem("/Volumes/MyUSBDrive", FolderItem.PathModes.Shell)

the_Shell.ExecuteMode = Shell.ExecuteModes.Synchronous
the_Shell.Execute("ls -a " + the_Folder.ShellPath)

shellResult = the_Shell.Result
FileList = shellResult.Split(EndOfLine) // put the file names into an array[/code]

Note: To find all files on the USB-Drive you can traverse all folders recursively.

I know the shell command, but “ls” doesn’t show these files and I will use this files in a FolderItem.

Hell,
“ls -a” show all files, even the hidden ones.

Since these Apple Double files mean nothing to any system BUT the Mac, you can simply delete them. If you’re needing to merge them for the Mac-specific elements, you can simply copy the main file back to the Mac’s native filesystem and it will be done automatically by Finder.

To find and delete them, something like this in a Shell will work:

find /Volumes/MountedDrive -name "._*" -delete

I use an app called HiM to clean up both directories and USB drives before delivery.
https://www.macupdate.com/app/mac/52076/him

To use it on Catalina or newer, provide it with Full Disk Access.

In that case, you will need to walk the tree checking the first two characters of the file names for each item.

One question that isn’t clear - since these have been and will be with us for a VERY long time, what is your true goal? Are you just trying to clean up the look of the file layout on the MSDOS/NTFS/VFAT drive when viewed on the Mac?

AppleScript is able to allow yu to see and even delete them. I do not say that previously because I was thinking you searched a solution in your project (did you check what I wrote earlier about magic file codes ?).

something like

In the script editor

(to see in an open dialog all files)

tell application “Finder”
choose file with invisibles
end tell