hidden files starting with colon not showing in finder--how to delete?

Was playing around with an AppleScript to generate vcards and initially didn't get the path name right. The result (oops) is that a whole batch of vcard files were written into the MacintoshHD-level directory.

The file names start with colons. I can't see them in the Finder, but I can see them in Terminal:

xxx-xxx-computer:/ xxxx$ ls
:Users:xxxx:Desktop:AddressBookVcards:xxxxx.vcf
:Users:xxxx:Desktop:AddressBookVcards:xxxxx2.vcf
(and so on, followed by the normal directory names you'd see in the Finder)

Is there any way to get this list of hidden file names in the finder so I can delete them easily with drag and drop? Any other suggestions? Thanks.

MacBook Pro 15"/2.16Ghz/2GB RAM Mac OS X (10.4.9)

Posted on Mar 29, 2007 8:01 AM

Reply
3 replies

Mar 29, 2007 8:20 AM in response to RKNYC

Colons are not legal characters in Mac filenames, which is why the Finder doesn't 'see' them.

However, if your goal is to remove them you can do that in the shell.

Assuming that the files are all .vcf files, and there are no vcf files in the top level of your drive that you want to keep, a simple:

<pre class=command>rmm /*.vcf</pre>

in a terminal window should take care of it.

Mar 29, 2007 7:38 PM in response to RKNYC

Hi RKNYC,
This is a subtle issue. The path separator is the character that delimits directory names in the path. As Camelot said, the path separator is never a valid filename character. The complexity comes in the fact that OS X has two ways of specifying a path, each with a different path separator. The classic OS use a colon as a path separator but UNIX components use a forward slash as a path separator.

Instead of eliminating both characters as valid filename characters, Apple made an interesting choice that really is the only way to eliminate just one character. If you put a forward slash in a filename in a carbon app, it will be allowed because carbon apps use classic paths internally so only a colon is disallowed. However, if you list the same file with a UNIX tool, you couldn't see a forward slash because that would be illegal. Instead, you see a colon in the place of the slash. There's an illegal character and the other one and if you put the other in a filename, it will change depending on context.

What happened to you is almost certainly the opposite of my example above. AppleScript can handle both contexts but the syntax for UNIX paths is tricky. What you probably did was use a UNIX path in a classic context. AppleScript took you to mean that you wanted a file at the top level of the drive that has a very long filename with lots of slashes in it. That is, your slashes were taken as filename characters: the other character. Then when you listed it in a UNIX context, those slashes turned to colons.

In order to get AppleScript to understand UNIX paths — to treat a forward slash as a delimiter — you have to specify the path as a POSIX path, like so:

Posix file "/var" as alias

That acts as a handle to a file, which you can create if it doesn't already exist. An alias doesn't have to exist while a file does.

There's one thing I don't understand: why the files would be invisible. I hate that AppleShowAllFiles option. I've got a lot of UNIX apps that store their preference files as hidden files (filenames beginning with a period) at the top level of my home directory. I couldn't find a thing if I had to sift through all of that. However, your filenames don't begin with a period and I just checked; on my machine, filenames beginning with a colon are shown in the Finder — they just begin with a slash. (the Finder is a Carbon app)
--
Gary
~~~~
An effective way to deal with predators is to taste terrible.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

hidden files starting with colon not showing in finder--how to delete?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.