The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   I'm stuck trying to delete a folder with double "."s (http://hintsforums.macworld.com/showthread.php?t=1327)

Bluecanary 02-28-2002 08:12 PM

I'm stuck trying to delete a folder with double "."s
 
I currently have hit a dead end when it comes to emptying the trash. When I try and empty it through the Finder, the file count goes up astronomically high (100,000+), yet there is only one folder in there. When I try to move the folder, the Finder's copy dialog screws over and I have to restart the finder. When I go into the command line and navigate my way to the folder in the trash, I find that it has 2 "." (this directory) files and 2 ".." (above directory) files, and I cannot delete either of them because rm prevents you from doing that. So... I'm stuck :( If anyone here knows what I can try please tell me as I put stuff in my trash a lot (I download a lot of files from the internet and stuff) and having to manually delete the stuff from the command line is becoming a big pain, and I can't stand seeing a "full" trash all the time that I can't empty.

~BC

Titanium Man 03-01-2002 01:19 AM

Hi there, I've played around with my .Trash file some, and it appears that when the GUI trash is emptied, the .Trash file disappears. It reappears or is remade when something is put in to the GUI trash. So, I'd recommend creating a test user, putting something into the test user's GUI trash, then doing the following (as the test user, of course):

cd ~
rm -r .Trash

Now try putting something else in the (test user) GUI trash. If you haven't broken the trash (and I don't think you will have since the .Trash is created again each time you put something into the GUI trash) you are then safe to experiment some MORE until you're satisfied that you can then rm -r the .Trash file in your normal user's home directory. That's just my own humble personal opinion, and it's probably worth what it cost you. :D Good luck!

mervTormel 03-01-2002 01:24 AM

don't try and delete anything any longer!

show us:
Code:

% sudo ls -l -R /fullPathTo/trash
that is, where you "navigate my way to the folder in the trash"

eriklager 03-01-2002 09:38 AM

I tried deleting the ~/.Trash folder and it worked fine. It gets re-created when you put something in the trash.
Code:

sudo rm -R ~/.Trash
Erik

moyashi 03-01-2002 10:48 AM

just wondering can't you just.
Code:

rmdir "..stuckfolder"
or
rmdir ....stuckfolder

the top using quotes and the bottom fighting dot with a dot?

Bluecanary 03-01-2002 04:43 PM

Here's the recursive listing of the .Trashes folder (it's on another volume, so there's only one .Trashes for the whole volume I believe). The stuff in red is the messed up part.
Quote:

sudo ls -la -R /Volumes/OS\ 9\ Disk/.Trashes
Password:
total 0
d-wx-wx-wx 4 peter unknown 92 Feb 25 16:48 .
drwxr-xr-x 64 peter unknown 2132 Feb 28 22:45 ..
drwx------ 2 peter unknown 24 Apr 11 2001 0
drwxrwxrwx 4 peter unknown 92 Mar 1 14:38 501

/Volumes/OS 9 Disk/.Trashes/0:
total 0
drwx------ 2 peter unknown 24 Apr 11 2001 .
d-wx-wx-wx 4 peter unknown 92 Feb 25 16:48 ..

/Volumes/OS 9 Disk/.Trashes/501:
total 16
drwxrwxrwx 4 peter unknown 92 Mar 1 14:38 .
d-wx-wx-wx 4 peter unknown 92 Feb 25 16:48 ..
-rw-rw-rw- 1 peter unknown 6148 Feb 28 22:45 .DS_Store
drwxrwxrwx 4 peter unknown 92 Feb 28 18:05 savedgames

/Volumes/OS 9 Disk/.Trashes/501/savedgames:
total 0
drwxrwxrwx 4 peter unknown 92 Feb 28 18:05 .
drwxrwxrwx 4 peter unknown 92 Feb 28 18:05 .
drwxrwxrwx 4 peter unknown 92 Mar 1 14:38 ..
drwxrwxrwx 4 peter unknown 92 Mar 1 14:38 ..


mervTormel 03-01-2002 04:57 PM

something terribly wrong there.

can you run disk utility verify on it? i would hope that would give you something to repair!

can you navigate to

/Volumes/OS 9 Disk/.Trashes/501/savedgames

and try
Code:

rm -i ./.
rm -i ./..

er, beware since your empty trash window filled up with 100,000 files, it might be traversing your entire OS9 filesystem. yikes.

whatever game that was, don't play it anymore.

Bluecanary 03-01-2002 05:30 PM

Disk Utility checked out fine. The only other disk utility I have is in Norton Utilities 5, and I have a feeling it won't find the error because it's a UNIX sort of thing and I believe the OS X update for Norton Utilities isn't free for version 5

Here's what I get when I do a rm -i ./. (or any other type of remove on . or ..):
Quote:

rm: "." and ".." may not be removed
and when I try and delete the directory:
Quote:

[localhost:OS 9 Disk/.Trashes/501] root# rm -r savedgames
rm: savedgames: Directory not empty
It seems really really weird that the filesystem can handle two sets of two identical files (in name, creation date, permissions, etc) in the same folder, so I guess this may be harder than I think to fix :confused:

silicondiode 03-01-2002 06:19 PM

. and .. are part of the system
 
sorry if i'm reading your post incorrectly, but if you go anywhere in the file system, every folder has a . and ..

if you type:

cd .

you'll end up in the current directory. if you type:

cd ..

you'll end up in the parent directory. the . and .. are file system components, thus they can't be deleted. DOS has 'em too...

Bluecanary 03-01-2002 06:31 PM

@silicondiode - I'm aware that they're part of the system, but the system expects there only to be one . and one .. in each folder (makes sense, there's only one directory you can be in and there's only one directory it can be in), so when the system sees two of each of those in there it seems to freak out, which is where my problems are being caused. Look at the post earlier where I listed the contents of the .Trashes directory, all the directories have one . and one .. except the savedgames one which has two of each of those.

stetner 03-01-2002 06:52 PM

I would try an:
Code:

ls -li /Volumes/OS 9 Disk/.Trashes/501/savedgames
to see if they refer to the same inodes (this is just to satisfy my curiosity).

The reason you are seeing so many files when you try to empty trash is probably that the system is recursing over the extra .. directory.

I would boot up in single user mode and do an fsck_hfs on your / disk.

Doug

Bluecanary 03-01-2002 06:59 PM

Here's what I get when listing the inodes:
Quote:

[localhost:.Trashes/501/savedgames] root# ls -lai
total 0
28868 drwxrwxrwx 4 peter unknown 92 Feb 28 18:05 .
28868 drwxrwxrwx 4 peter unknown 92 Feb 28 18:05 .
1385364 drwxrwxrwx 3 peter unknown 58 Mar 1 15:20 ..
1385364 drwxrwxrwx 3 peter unknown 58 Mar 1 15:20 ..
Looks like it thinks there's two of the same file for each of those. I'm off to try an fsck_hfs I guess.

mervTormel 03-01-2002 07:05 PM

yep. what doug said. that's where i was going next.

but, this:

--
I would boot up in single user mode and do an fsck_hfs on your / disk
--

needs to be changed to...

...single user mode and do an fsck_hfs on the OS9 disk at /Volumes/OS 9 Disk

that may be trickier than it sounds. you going to have to know it's /dev/disk name, i think. so before you boot to single user, get it's disk name out of the df command.

but, even better, you can do it while you're up and running, provided you have no files open on OS9...
Code:

% df
Filesystem          1k-blocks      Used Available Use% Mounted on
/dev/disk2s9          7326256  2148640  5177616  30% /
devfs                        1        1        0 100% /dev
fdesc                        1        1        0 100% /dev
<volfs>                    512      512        0 100% /.vol
/dev/disk2s10          7326256    608380  6717876  9% /Volumes/banshee
/dev/disk2s11          7326256  2978620  4347636  41% /Volumes/chunder
/dev/disk2s12          7326256    909136  6417120  13% /Volumes/data
/dev/disk2s13          7326256  2144000  5182256  30% /Volumes/ebola
/dev/disk2s14          7326256  2959176  4367080  41% /Volumes/flivver
/dev/disk2s15          7326256  4388036  2938220  60% /Volumes/gunt
...

% sudo fsck_hfs /dev/disk2s15
** /dev/rdisk2s15
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** The volume gunt appears to be OK.

you may have to run that a few times. let us know the results of that.

Bluecanary 03-01-2002 07:14 PM

I ran it only on that partition (I just used mount in the terminal to figure out what /dev file it was) and it checked out fine, unless my mind is failing me it looks like that may well be what Disk Utility runs to check disks (run Disk Utility and the output looks mighty similar). So, back to the drawing board... maybe I should take a trip to the local Apple Store and see if the geniouses there could help me a bit, I doubt they could, but it's amazing sometimes what Apple teaches those guys.

stetner 03-01-2002 07:14 PM

Quote:

fsck_hfs on the OS9 disk at /Volumes/OS 9 Disk
Right you are, I forgot that he was on his OS9 partition.....

stetner 03-01-2002 07:19 PM

Well, then you could always try to clear the inode(s) and run fsck again. Note that I have not tried this on an hfs+ file system.

CLRI(8) System Manager's Manual CLRI(8)

NAME
clri - clear an inode

SYNOPSIS
clri special_device inode_number ...

DESCRIPTION
Clri is obsoleted for normal file system repair work by fsck(8).

Clri zeros out the inodes with the specified inode number(s) on the
filesystem residing on the given special_device. The fsck(8) utility is
usually run after clri to reclaim the zero'ed inode(s) and the blocks
previously claimed by those inode(s). Both read and write permission are
required on the specified special_device.

The primary purpose of this routine is to remove a file which for some
reason is not being properly handled by fsck(8). Once removed, it is
anticipated that fsck(8) will be able to clean up the resulting mess.

SEE ALSO
fsck(8), fsdb(8), icheck(8), ncheck(8)

BUGS
If the file is open, the work of clri will be lost when the inode is
written back to disk from the inode cache.

4th Berkeley Distribution April 19, 1994 4th Berkeley Distribution

Bluecanary 03-01-2002 07:24 PM

I think it's probably worth a try, the partition is an old partition on the drive that used to be in my iMac, I put it in my new g4 temporarily so I could copy files and stuff quickly and easily, so the data on there isn't *extremely* important. I'll go ahead and try it, I'd do anything (besides reformat) to get rid of my trash being full all the time... I keep checking to see what's in my trash and why it has stuff in it, and find that stupid folder haunting me.

mervTormel 03-01-2002 07:27 PM

doug, what do you make of that?! that makes my nipples ache.

blue, humor us:

do you have the developers tools installed?
Code:

% /Developer/Tools/GetFileInfo ./.
directory: "./."
type: ""
creator: "*"
attributes: avbstclINMed
created: 12/13/2001 04:41:36
modified: 03/01/2002 17:24:24

% /Developer/Tools/GetFileInfo ./..
directory: "./.."
type: ""
creator: "Q?
            attributes: avbstclINMed
created: 09/02/2001 20:52:04
modified: 02/17/2002 22:38:20

yikes! before you clri anything, shunt we see that those inodes aren't pointing to anything good?

blue, can we eyeball your fsck of that volume just for grins?

let's slow down a little.

Bluecanary 03-01-2002 07:34 PM

Here's the GetFileInfo of the both:
Quote:

[localhost:.Trashes/501/savedgames] root# GetFileInfo ./..
directory: "./.."
type: ""
creator: ""
attributes: aVbstclinmed
created: 02/25/2002 23:48:21
modified: 03/01/2002 22:20:33
[localhost:.Trashes/501/savedgames] root# GetFileInfo ./.
directory: "./."
type: ""
creator: "?attributes: avbstclINMed
created: 01/12/1999 05:12:07
modified: 03/01/2002 01:05:49
And the fsck_hfs:
Quote:

[localhost:/Users/peter] root# fsck_hfs /dev/disk0s9
** /dev/rdisk0s9
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking multi-linked files.
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** The volume OS 9 Disk appears to be OK.

mervTormel 03-01-2002 07:52 PM

boy, i'd like to get my hands on that mother-loving bunny-funster. that's one for the record books.

know emacs? emacs has a directory editor mode.

would you try

SetFile -a vINM ./.

and see if any nuts fall off the tree. i think just that ./. file is causing the fits.

BTW, do you happen to know what app created these files entries? or was there an error in moving something in OS9 to the trash? it would be good to know to warn others.


All times are GMT -5. The time now is 06:17 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.