Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-04-2003, 12:28 PM   #1
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
Undeletable files?!

I have a file that I just cannot delete.

The filename contains some Unicode characters that seems to make it impossible to unlink it.

When I empty the trash, Finder logs this to the console:
Finder tool: request to change uid to 501 gid to -1 for /Users/me/.Trash/bbb/MatÌûö̺?.dclst

I tried to change the filename through the Finder, but that just gives me another error message:
Operation could not be completed, error code -43.

So I tried using the shell:

I can see the offending file using /bin/ls (/sw/bin/ls won't work):
$ ls /Users/me/.Trash/bbb/
Mat??????.dclst

But the -l switch doesn't work:
$ ls -l /Users/me/.Trash/bbb/
ls:

Removing the file doesn't work:
$ sudo rm -rf bbb/*
gives no error message, but the file is still there:
$ ls bbb
Mat??????.dclst

Removing the enclosing folder doesn't work:
$ sudo rm -rf /Users/me/.Trash/bbb
rm: bbb: Directory not empty

Of course I can't rename the file or change permissions, because the shell won't handle the filename correctly..

Any ideas anyone?

Thanks,
-sapporo.
sapporo is offline   Reply With Quote
Old 04-04-2003, 01:08 PM   #2
xchanyazy
All Star
 
Join Date: Jan 2002
Location: Dexter, MI, USA
Posts: 704
http://forums.macosxhints.com/showth...hlight=unicode

Try the hint in the second to last post, maybe?
__________________
- Greg

Happy user of OS X since the Public Beta.
Help Team Mac OS X cure cancer, Alzheimer's, ALS, Parkinson's, and more!
xchanyazy is offline   Reply With Quote
Old 04-04-2003, 02:03 PM   #3
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
Doesn't help, unfortunately.

$ ls bbb
Mat??????.dclst
$ ls -i bbb
ls:

Thanks anyway,
-sapporo.
sapporo is offline   Reply With Quote
Old 04-04-2003, 02:10 PM   #4
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Try Super Get Info - it has a menu item for deleting the trash that, in my experience, is pretty good at getting rid of stubborn files.
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 04-04-2003, 02:16 PM   #5
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
Nope.

2003-04-04 21:14:42.236 Super Get Info Helper[1513] CFLog (20): Error: An error occurred while trying to empty the trash with Super Get Info. Mac OS Error Code: -9875.
sapporo is offline   Reply With Quote
Old 04-04-2003, 02:26 PM   #6
sikity
Prospect
 
Join Date: Apr 2003
Posts: 12
I have turned tab completion back on for tcsh. If you have also turned on tab completion what you might try is

rm -f Users/me/.Trash/bbb/Ma<press tab>

for me that would complete the file so the shell can use it.

you also might just try removing the file through sudo incase there is a permission problem.
sikity is offline   Reply With Quote
Old 04-04-2003, 02:28 PM   #7
xchanyazy
All Star
 
Join Date: Jan 2002
Location: Dexter, MI, USA
Posts: 704
This is usually the point where it's suggested to jump into OS 9 and delete it, but I refuse to believe that there is no way to delete it in OS X.

If you don't mind messing around, try cd'ing to the folder.

Then, type sudo rm -f Mat[tab]

if it doesn't complete (I'm guessing you've probably already tried this), what about if you're using a different shell (bash or ksh or ?)

Or possibly sudo rm -f *.dcslt

Also, what about using Trash It!
http://www.nonamescriptware.com/

Or possibly su root?

As a last resort before OS 9, what about booting into single user mode?
__________________
- Greg

Happy user of OS X since the Public Beta.
Help Team Mac OS X cure cancer, Alzheimer's, ALS, Parkinson's, and more!

Last edited by xchanyazy; 04-04-2003 at 02:30 PM.
xchanyazy is offline   Reply With Quote
Old 04-04-2003, 02:39 PM   #8
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
Quote:
This is usually the point where it's suggested to jump into OS 9 and delete it

Now that's something I hadn't thought about! But it feels like cheating :-)

Quote:
Then, type sudo rm -f Mat[tab]

Doesn't complete. Yes, I tried that :-)

Quote:
Or possibly sudo rm -f *.dcslt

Nope.

Quote:
Also, what about using Trash It!
http://www.nonamescriptware.com/

Haven't tried it, but I guess it works like SuperGetInfo to avoid permission problems, but this is something different.

Quote:
As a last resort before OS 9, what about booting into single user mode?

I thought about it, but haven't tried so far. Since it's not a permission problem, I doubt it will work.

Thanks guys!

Later,
-sapporo.
sapporo is offline   Reply With Quote
Old 04-04-2003, 04:02 PM   #9
breen
Major Leaguer
 
Join Date: Jan 2003
Location: Bay Area
Posts: 327
Here's one from the Unix faq that you might try:

first get the inode number of the file:
ls -i *


32700 Mat??????.dclst

then:

find . -inum 32700 -ok mv '{}' new-name \;

should let you rename the problem file.

(you can also just remove it with:
find . -inum 32700 -ok rm '{}' \;
)

Breen
breen is offline   Reply With Quote
Old 04-04-2003, 04:08 PM   #10
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
That's what xchanyazy referred to in his post, but it won't work (see above).

Thanks anyway,
-sapporo.
sapporo is offline   Reply With Quote
Old 04-04-2003, 04:24 PM   #11
breen
Major Leaguer
 
Join Date: Jan 2003
Location: Bay Area
Posts: 327
Damn, damn, damn.
I checked that thread -- must have gotten a partial page because it didn't show up the first time. I just reloaded it and found the first post.

Sorry.

Breen
breen is offline   Reply With Quote
Old 04-04-2003, 11:06 PM   #12
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
unlink in Perl

You should be able to find out the name of the file in terms of octal values for the non-ASCII characters by using 'vis -o' or 'od -c'.
Use 'ls' to pipe the name to one of the above.
E.g.:
ls bbb | vis -o

Once you have the full name of the file, you should be able to delete it by using the 'unlink' command in a Perl script.
Here's the example from the O'Reilly UNIX Power Tools book (where I got this idea):
perl -e 'unlink("\t\360\207\005\254");'

But you might even be able to delete it by putting the full name (using octal escapes) inside double quotes:
rm "\t\360\207\005\254"

Last edited by hayne; 04-04-2003 at 11:09 PM.
hayne is offline   Reply With Quote
Old 04-05-2003, 01:12 AM   #13
macmath
MVP
 
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
This might really be stupid, but it would not be the first time that I said something stupid so here goes.

This is assuming that problem file is in the folder bbb.

0. Can you change its name in the Get Info window?

1. Set DropStuff to delete the original after stuffing and then drop the folder bbb onto DropStuff?

2. Does gzip have an option that lets you use gzip on a folder? ...gzip automatically deletes the original.
macmath is offline   Reply With Quote
Old 04-05-2003, 10:25 AM   #14
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
macmath, i consider those very clever approaches. thanks for steering at a problem from different vectors.
mervTormel is offline   Reply With Quote
Old 04-06-2003, 05:56 AM   #15
gatorparrots
Major Leaguer
 
Join Date: Dec 2002
Posts: 441
The file may have an immutable flag or system immutable flag set. Learn how to unset it here:
http://www.osxfaq.com/Tutorials/Lear...Trash/index.ws
gatorparrots is offline   Reply With Quote
Old 04-06-2003, 06:15 AM   #16
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
That wouldn't explain why I can't ls it properly. I'm convinced it's the filename that's causing the problem.

I'll try to delete the file by mounting my drive in FireWire target disk mode.
sapporo is offline   Reply With Quote
Old 04-06-2003, 11:48 AM   #17
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
what didn't work?

Sapporo, could you please tell su which of the suggested deletion methods you have tried and why they didn't work?
This is important for future reference - for others who may have similar problems later.
hayne is offline   Reply With Quote
Old 04-07-2003, 08:50 AM   #18
sapporo
Triple-A Player
 
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
I tried renaming the file through Finder (by selecting the filename and the Get Info window). Finder logs an error message to the console (see above).

I tried SuperGetInfo, but it fails just like Finder (see above).

I tried all the shell-based methods mentioned so far, but none of them worked. I missed hayne's post about vis and od at first, and found out I could achieve the same result (the filename with non-printable characters in octal representation) with ls -b (I'm using gnu ls which is part of the gnu fileutils package available through fink):

$ ls -b
Mat\355\236\232\355\274\262.dclst

Still, I can't get any shell command to work on this file:

$ rm "Mat\355\236\232\355\274\262.dclst"
rm: Mat\355\236\232\355\274\262.dclst: No such file or directory

But hey, I feel I'm getting closer.

Thanks all,
-sapporo.
sapporo is offline   Reply With Quote
Old 04-07-2003, 11:08 AM   #19
macmath
MVP
 
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
Quote:
Originally posted by gatorparrots
The file may have an immutable flag or system immutable flag set. Learn how to unset it here:
http://www.osxfaq.com/Tutorials/Lear...Trash/index.ws

Quote:
Originally posted by sapporo as a response to this
That wouldn't explain why I can't ls it properly. I'm convinced it's the filename that's causing the problem.

I'll try to delete the file by mounting my drive in FireWire target disk mode.

Not necessarily, I think. I think the file has several attributes that make it difficult to trash and the presence of unicode characters in the name is only one of them. I created a plain file with the name "MatÌûö̺?.dclst" given in the original post and put it in a folder called bbb. [I used "touch cat" and then changed the name of cat to MatÌûö̺?.dclst] Perhaps there is something about the name/characters which you could not post due to Forum formatting and so this is all moot.

While I could not ls it or directly work with it via the command line, I could rm bbb/* and change its name at will. I even gave it an immutable flag 'sudo chflags -R uchg bbb' and I was still able to trash it, although I could no longer change its name. However, while it had an immutable flag, it had a little lock in the lower left of its icon (something I'm sure you would not have missed). I then cleared this flag, gave it root:admin privileges with no read or write by anyone and then gave it an immutable flag as well. Now I could not trash it or change its name, but I could clear the flag, give myself privileges for it, and trash it.

Anyway, while this experiment is not perfect since I might not be able to duplicate the name exactly, or might not be allowed to change the name to something which I can't also change it away from, I think the problem goes beyond the name itself. Perhaps a disk repair with Disk Utility or DiskWarrior is in order to discover something wonky about the catalog.

Last edited by macmath; 04-07-2003 at 11:11 AM.
macmath is offline   Reply With Quote
Old 04-07-2003, 03:13 PM   #20
Englabenny
Triple-A Player
 
Join Date: Feb 2003
Posts: 55
i remember

I have experienced this, with files with latin-1 characters in them (not all i have, whew!, just 3-4), swedish characters like åäö

I think either the files were removed, but spooked in the disk TOP, or they are named such that nothing between the kernel and aqua can handle them.

The only way I've been able to get rid of the files have been:

1 remove hosting folder in OS9
2 reformat and install
3 hide it somplace it won't bother (move hosting folder)
Englabenny is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:33 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.