The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   Undeletable files?! (http://hintsforums.macworld.com/showthread.php?t=10758)

sapporo 04-04-2003 12:28 PM

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.

xchanyazy 04-04-2003 01:08 PM

http://forums.macosxhints.com/showth...hlight=unicode

Try the hint in the second to last post, maybe?

sapporo 04-04-2003 02:03 PM

Doesn't help, unfortunately.

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

Thanks anyway,
-sapporo.

djn1 04-04-2003 02:10 PM

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.

sapporo 04-04-2003 02:16 PM

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.

sikity 04-04-2003 02:26 PM

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.

xchanyazy 04-04-2003 02:28 PM

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?

sapporo 04-04-2003 02:39 PM

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.

breen 04-04-2003 04:02 PM

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

sapporo 04-04-2003 04:08 PM

That's what xchanyazy referred to in his post, but it won't work (see above).

Thanks anyway,
-sapporo.

breen 04-04-2003 04:24 PM

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

hayne 04-04-2003 11:06 PM

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"

macmath 04-05-2003 01:12 AM

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.

mervTormel 04-05-2003 10:25 AM

macmath, i consider those very clever approaches. thanks for steering at a problem from different vectors.

gatorparrots 04-06-2003 05:56 AM

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

sapporo 04-06-2003 06:15 AM

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.

hayne 04-06-2003 11:48 AM

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.

sapporo 04-07-2003 08:50 AM

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.

macmath 04-07-2003 11:08 AM

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.

Englabenny 04-07-2003 03:13 PM

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)

sapporo 04-10-2003 07:23 AM

I finally got sick of all this and mounted my PowerBook on my girlfriend's PowerBook in FireWire target disk mode. Contrary to what I expected, I could delete the file from Finder without a problem. And yes, that makes it look like a permission problem..

I guess now I'll never find out what the real problem was :-(

Thanks again all,
-sapporo.

macmath 04-11-2003 08:29 AM

It is too late now, of course, but if this crops up again, perhaps this suggestion might be useful. Apple came out in late February with an application called the "File Name Encoding Repair Utility". You can find the Apple KnowledgeBase document about it (and a download link) by going to Sherlock 'AppleCare' and doing a search on 'encoding repair'.

Excerpt:
Quote:

The Mac OS 9 Finder uses Apple-specific Mac OS character sets (such as MacRoman or MacJapanese) to enter and display file names. The Mac OS X Finder uses a worldwide standard character encoding, named Unicode, to enter and display file names. Mac OS 9 converts file names to Unicode for storage on Mac OS Extended volumes, but when the encoding differs from the system default (for example, a Japanese file name on an English system or vice versa) the conversion to Unicode can be incorrect. As a result, the file name may not display as expected. The Mac OS X File Name Encoding Repair utility will correct many of the common cases of incorrect conversion.

rmanke 03-27-2007 12:51 PM

I am having the exact same problem with a file with the name "Ti?ng Viê?t.html"

The system and none of the applications on the system can see this file, including Apple's utility! Therefore, it is impossible to delete.

Is there a way to delete this file without having to install OS 9?

Ron

rmanke 03-27-2007 12:55 PM

This issue is four years old??? Is anyone still reading this thread?

I wouldn't mind if a kind person could read this and get back to me, because I cannot subscribe to this thread for some reason. (probably because I am new).

Ron

sapporo 03-27-2007 05:13 PM

I'm still subscribed, but haven't come up with a solution yet :-)

tatilsever 03-27-2007 06:09 PM

Quote:

Originally Posted by rmanke (Post 368324)
I am having the exact same problem with a file with the name "Ti?ng Viê?t.html"

Is this a Photoshop related file? If so, I believe Adobe has posted a solution on its website.

rmanke 03-27-2007 06:13 PM

Quote:

Originally Posted by tatilsever (Post 368405)
Is this a Photoshop related file? If so, I believe Adobe has posted a solution on its website.

Yes it is!

I'll check and see if I can find anything...

Thanks!

rmanke 03-27-2007 06:20 PM

I don't suppose you could point me to the issue... i've looked high and low on Adobe's web site. There are many issues related to deleting files on their site...none of them seem to address this issue...

I would really appreciate any pointers...

Quote:

Originally Posted by tatilsever (Post 368405)
Is this a Photoshop related file? If so, I believe Adobe has posted a solution on its website.


rmanke 03-27-2007 07:08 PM

Success!!
 
Just so people don't have to go searching through dozens of threads, I found the solution to this particular issue.

Apparently, certain file names cause the directory structure to be confused, and there are files that don't exist showing up on your hard drive.

This is apparently an illegal file name that causes problems.

If you run the Disk First Aid, by booting off of your CD-ROM and selecting Disk Repair, it will fix your directory structure.

The method for rebooting into single user mode, and issuing an "fsck" command will do the same thing.

Ron


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