deleting a "." file

xegan

hunger buster
somehow, a file named "." got onto my computer
(I'm guessing here, because...).

I've got a long string of nested folders, with the
bottommost containing two "." files.

It won't let me empty these in the trash, and
it won't let me rename or delete either file called "."
They are both listed as directories, but that may
just be unix overriding by filename?...

I've tried just about everything I know to try in
OSX. Do I need to go back to OS9 to get rid of this?


weird...
 
You must be viewing these from the Terminal, no?

'.' is the current directory. '..' means the parent directory, so
Code:
$ [b]cd .[/b]
does (effectively) nothing whereas
Code:
$ [b]cd ..[/b]
moves you up one directory.

Did I totally misunderstand your question?

-Rob
 
yeah, maybe I didn't explain properly.

I downloaded a tutorial a while back (pre-OSX) that had
(i guess) a file in there called "." Under OSX, it sees
this "." in addition to the regular "." and ".." dirs that
indicate "this dir" and "parent dir". I think that it may
have been an image file, but unixisms have re-appropriated
it and made it a dir (??)

I noticed all of this while trying to delete a set
of folders. One folder nested down deep was
preventing all its parent directories from be emptied
from the trash. I looked in this bottommost directory
and found that it had TWO "." entries and one "..",
otherwise empty.

------------------------------------------
[localhost:Behavior Demo/Library/Media] xegan% ll
total 0
drwxr-xr-x 4 xegan unknown 264 Feb 8 19:27 .
drwxr-xr-x 4 xegan unknown 264 Feb 8 19:27 .
drwxr-xr-x 3 xegan unknown 58 Feb 8 19:19 ..
[localhost:Behavior Demo/Library/Media] xegan%
------------------------------------------


If I try to move these folders from the trash, I get some
freaky copy windows wiggin' out on me, so I've been trying
to fix this via the CLI.

(dir = directory = folder)
 
Hmm. I don't think it's possible to create a file or directory with a single '.' or double '..' name. The reason for this is that every directory should already have a '.' and a '..' upon creation. Trying to create another with the same name should give an error (like trying to create two files named 'joebob' in the same directory).

I bet that directory has a '.' as the first character, and it's followed by one or more spaces. You may be able to remove it by enclosing the name in quotes and adding a various amount of spaces after the '.'

I have yet to use OSX, but under Linux and many other unices you can recursively remove a directory's subdirectories and files by appending a -r flag to the rm command. For example: rm -r parent_directory_name

So, I would try to move up one directory to the parent directory of the one with the extra '.' entry. Then try the recursive remove command (hopefully OSX's version supports this option).

Good luck, and I hope this works for you.
 
to refer to a file in the current dir, you sometimes need to use dot-slash, like this:
./setup
(At least, this is true for some linux things)

If there really is a dir called '.' then you might try:
rm -rf ./.

But be careful to backup first, just in case. Such a file SHOULD NOT exist, but since it apparently does, that might work.
 
I think that Nathans theory is correct.
At least it works on an ordinary Unix.

you can create such a file/dir by enclosing a
dot and some spaces in " ":
$ touch ". "
or
$ mkdir ". "

when you type ls -a you should get a listing
of all the files in that directory. The -a
option is important, because without every
file starting with a dot is regarded as
invisible configuration file eg.: .profile

$ ls -a
./ This is your current directory
. / This is your mysterious file or dir
../ the parent directory


if you know about the spaces you can remove it with rm.

BTW: this is a comon way to hide trojans
and other "nice" things. So perhaps you
should inspect it before deleting.
 
to rinoa and Nathan:
There's no space in the filename.

[localhost:Behavior Demo/Library/Media] xegan% ls -laF
total 0
drwxr-xr-x 3 xegan unknown 58 Feb 8 19:27 ./
drwxr-xr-x 3 xegan unknown 58 Feb 8 19:27 ./
drwxr-xr-x 3 xegan unknown 58 Feb 10 02:29 ../

I think that the "." file was possibly made under OS9
There were other files named by single digits. (eg. "4").
I remember when I originally tried to empty trash,
the finder barked at me about the "0" file in that folder.
-OR-
it's likely something is wrong with the filesystem
as testuser reasons.

I've tried various rm -rf without sucess.
(Including rm -rf ./. - thanks symphonix)
I always get the following error:
"rm: "." and ".." may not be removed"

As for my "freaky copy", the little copy dialog box
that comes up is litterally freaking out, with scrambled,
overlapping text, and progress bar blinking/flashing
rapidly, reminding me of a epileptic-mac-vegas.
It then eventually locks up the finder, and I have to
FQ/relaunch the finder. This behavior appears if I try to
move the files anywhere outside the trash.

I'll try the fsck utility. The problem is on my ext firewire.
/Volumes/firewire/.Trashes/501/a_buncha_directories/problemDirectory/

I'll also try (eek) rebooting into OS9, and see if the file/dir
doesn't pop up there...


thanks all for your replies...
 
did some (probably much needed) fsck, but
couldn't target my ext. firewire drive, just my
OSX boot partition. couldn't man in singleuser
mode to see how to change volumes.

rebooted into OSX, was able to move the
offending folders out of the trash without the
copy window freakin out.

rebooted into OS9, and voila, it was a GIF FILE
called "." with a Graphic Converter type.
Threw it in the trash, emptied, and it's gone!!!

rebooted into OSX, and all is good....

[[ I think that if UNIX sees a file called "." it overrides
all of its real properties, and labes it as a directory with
all the usual unix "." directory properties. ]]
 
Back
Top