Undeletable nested folders in Trash - Terminal expert please??

Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Well, doesn't look like an ACL problem. Probably an illegal character in the name problem.
Can you rename it. in Get Info window? Something simple like POSWONTGOAWAY ?
For that matter, can you cd into it? Is it empty?
 
OP
Kryten
Joined
Mar 20, 2006
Messages
176
Reaction score
10
Points
18
Location
England
Your Mac's Specs
3.8 GHz 8-Core Intel Core i7 AMD Radeon Pro 5500 XT 8 GB / 80 GB 2133 MHz DDR4
Well, doesn't look like an ACL problem. Probably an illegal character in the name problem.
Can you rename it. in Get Info window? Something simple like POSWONTGOAWAY ?
For that matter, can you cd into it? Is it empty?

Nope, won't let me rename of move out of Trash. Get info does say Select new original though, does that mean anything significant?

(Off to bed now Zzzzzzzzz...here in the UK)
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Get info does say Select new original though, does that mean anything significant?

"Normally" that means you're looking at an alias. Now I don't know what we got :( .
Last resort..
Make sure you're in your Home folder - type cd by itself.
Now type sudo rm -rf .Trash
Give it password.
If it works, log out/in. .Trash should be rebuilt by System.
 
OP
Kryten
Joined
Mar 20, 2006
Messages
176
Reaction score
10
Points
18
Location
England
Your Mac's Specs
3.8 GHz 8-Core Intel Core i7 AMD Radeon Pro 5500 XT 8 GB / 80 GB 2133 MHz DDR4
"Normally" that means you're looking at an alias. Now I don't know what we got :( .
Last resort..
Make sure you're in your Home folder - type cd by itself.
Now type sudo rm -rf .Trash
Give it password.
If it works, log out/in. .Trash should be rebuilt by System.

No good I'm afraid Craig thank you. Everything still there....:(

Although it's looking like an alias, it's only the last folder that displays Select New Original, and Show Original is grayed out. I did type:
~
sudo rm .Trash
Password

Log out and in. Then I re-read your post and typed:
~
sudo rm -rf .Trash
Password was not requested
 
Joined
May 19, 2009
Messages
8,428
Reaction score
295
Points
83
Location
Waiting for a mate . . .
Your Mac's Specs
21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
What happens with that file and the Folders if you drag the offending File/Folder to the Trash and have it in there as just that file. Can you then Empty Trash, and those Folders it was in disappear ??
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
Using Find Any File

Download and use Find Any File if you don't have it already:
Thomas Tempelmann - Find Any File

Use the Finder to copy the stubborn file/folder name, open FAF and paste in the copied name

Author of FAF here. Thanks for suggesting to use my app. Sadly, it's not helping this particular user, either, yet.

A little hint: No need to copy/paste the name - dragging the item (file) into the name field works as well. That way, you can also drag a file's FileType, Creator Code, etc, into FAF's input fields.

Now I stay tuned for the resolution of this mystery undeletable item...

If nothing else helps, I could have the user install my other disk tool, iBored, and then I'd remotely access his disk and patch the directory sector under OS X's nose ;)
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
Do not use "*.*" but "*"

I saw quite a few suggestions to use "*.*" when deleting all files in a folder. That's wrong - we're not on Windows here.

To select all items in a directory, a single * should be used. With *.* you'd end up deleting only files that contain a period in their name, which isn't helpful here.
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
Badly encoded name is the probably the cause

The final folder has a really long 'meaningless' title.

Right, that might be the cause of the issue. There are certain characters one can put into a file name on disk that OSX can't handle, e.g. there used to be times when 00-Bytes in the name caused problems (maybe they still do), and illegal unicode byte sequences may be causing such an issue as well, because when you try to delete a file, you have to specify its name in unicode, but if the name on disk uses bytes that you cannot express in unicode, then you're screwed.

Since this file name appears to be created from some recovery software, it might well be that the software did not fix "bad names" and leaves this mess behind now.

Maybe patching the bad name with iBored is indeed the only way, apart from erasing ("formatting") the disk. But to use iBored, I'd at least need to be able to find the bad name on disk first. The more properties of the item are known (fragments of the name, size, etc.), the easier it might be to use iBored's Find command to find the directory block. Unfortunately, iBored can't walk HFS+ directory structures yet. I wish Norton Disk Editor was still around. With that, this would be very easy.
 
OP
Kryten
Joined
Mar 20, 2006
Messages
176
Reaction score
10
Points
18
Location
England
Your Mac's Specs
3.8 GHz 8-Core Intel Core i7 AMD Radeon Pro 5500 XT 8 GB / 80 GB 2133 MHz DDR4
What happens with that file and the Folders if you drag the offending File/Folder to the Trash and have it in there as just that file. Can you then Empty Trash, and those Folders it was in disappear ??

The offending nested folders are already in the Trash, and I can't move them out. If I try that it just copies them to the desktop.
 
Joined
Sep 17, 2012
Messages
142
Reaction score
2
Points
18
Your Mac's Specs
Macbook Pro 13” i5 (2012) , iPhone5 16GB (white), iPhone4 8GB (white), iPad2 64GB 3G, Apple TV
What about this?

1. Open Terminal
2. Copy and paste chflags -R nouchg inside terminal screen. do not press return yet
3. Open trash bin
4. Press command-A to select all files at once
5. Drag them all inside the Terminal screen
6. Press return
7. You are done! close everything. open trash and delete all your files.
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
Everyone, you can stop making suggestions. The names are indeed corrupted, to the point where OSX cannot translate the names properly into unicode any more, hence any operation that tries to address the files by name will internally fail - that's why trying to delete or rename them won't work at that level.

I know this because I've now looked at the disk using iBored, finding the corrupted entries, containing control chars and even Backspace chars in their name. They appear to be a result from recovering files and folders with Disk Rescue 3, with the effect that DR3 did not clean up the bad names that were - apparently, never meant to be files in the first place (meaning DR3 recovered data that it believed to be directory entries which were, in fact, not).

I have now started fixing the bad names and am in the middle of improving iBored to the point to make this easier in the future.
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
65,246
Reaction score
1,834
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 8, iPhone 11, iPhone 12 Mini, Numerous iPods, Monterey
Welcome to our Forums!

Always a pleasure to have a developer respond. And thanks for your App, I've used it many times myself. :)
 

RavingMac

Well-known member
Staff member
Moderator
Joined
Jan 7, 2008
Messages
8,304
Reaction score
244
Points
63
Location
In Denial
Your Mac's Specs
16Gb Mac Mini 2018, 15" MacBook Pro 2012 1 TB SSD
This is going nuclear on your problem, but at this point I personally would be frustrated enough (and stubborn enough to do so). You will need:

1) a spare external drive
2) either Carbon Copy Cloner or Super Duper

First step is to clone your Hard Drive (you really ought to have a bootable backup anyway)
Second, boot from and test your cloned drive.
Third, once you are sure your clone is good and all your files are backed up, reformat your internal HD using single pass secure erase.
Fourth, either restore from the clone or just reinstall the OS and move selected files back (handy if you're trying to recover wasted disk space)

This ought to get rid of your hanging file either way.
 
OP
Kryten
Joined
Mar 20, 2006
Messages
176
Reaction score
10
Points
18
Location
England
Your Mac's Specs
3.8 GHz 8-Core Intel Core i7 AMD Radeon Pro 5500 XT 8 GB / 80 GB 2133 MHz DDR4
Thanks to everyone for these later suggestions. As tempel.org is donating his time in depth, to whom I'm eternally grateful, I won't attempt any further suggestions until he has finished. But to answer RavingMac's suggestion, the only reason I didn't do this is I assumed a SuperDuper clone will bring the problem with its cloned copy. I didn't think it would lose it on the way?
 
OP
Kryten
Joined
Mar 20, 2006
Messages
176
Reaction score
10
Points
18
Location
England
Your Mac's Specs
3.8 GHz 8-Core Intel Core i7 AMD Radeon Pro 5500 XT 8 GB / 80 GB 2133 MHz DDR4
Well, finally after a considerable amount of work by the Developer of Find Any File (recommended by pm-r, thanks for that), apps.tempel.org (Thomas Tempelmann) first made it removable from the Trash, then he was able to remotely access my drives and do his stuff using his app iBored.

I'm a big fan of keyboard shortcuts and having something undeletable in the Trash was a major pain.

I'm off to make a donation now.

Sincere thanks to everyone who offered advice or suggestions to try. It was all much appreciated.

Kryten
 
Last edited:
Joined
Oct 16, 2010
Messages
18,179
Reaction score
1,921
Points
113
Location
Brentwood Bay, BC, Canada
Your Mac's Specs
2020 27" i9 5K nano iMac, 1TB(partitioned) SSD, GB, macOS 15.3.1 Sequoia
Congratulations to Thomas Tempelmann, the Developer of Find Any File for the success!!

And WOW!!! I knew his FAF app software and his support is excellent, but I sure didn't know he extended his help so far and so well. ;)

And for those who haven't already downloaded or used any of his software, I'm sure Thomas Tempelmann would appreciate all purchases and/or donations be done via his site rather than Apple's App Store when possible.
 

RavingMac

Well-known member
Staff member
Moderator
Joined
Jan 7, 2008
Messages
8,304
Reaction score
244
Points
63
Location
In Denial
Your Mac's Specs
16Gb Mac Mini 2018, 15" MacBook Pro 2012 1 TB SSD
Thanks to everyone for these later suggestions. As tempel.org is donating his time in depth, to whom I'm eternally grateful, I won't attempt any further suggestions until he has finished. But to answer RavingMac's suggestion, the only reason I didn't do this is I assumed a SuperDuper clone will bring the problem with its cloned copy. I didn't think it would lose it on the way?

Glad it worked out.

My reason for suggesting the method I did was assuming that since the OS couldn't touch the files to rename or delete, CCC or SuperDuper wouldn't copy them. Might not have worked, but worth a try if no other way.
In this case you had expert help to solve the problem.
Kudos to temple.org for the solution.
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
My reason for suggesting the method I did was assuming that since the OS couldn't touch the files to rename or delete, CCC or SuperDuper wouldn't copy them. Might not have worked, but worth a try if no other way.
That would have surely worked, but was overkill. This copying process will usually case lots of little annoyances, such as some Aliases not working any more and some registered programs needed new registration. Lots of pesky things.

In fact, had I (or someone else, or maybe a better Disk Utility) not fixed the catalog entries directly as it were, your suggestion would have been the only way to get rid of the issue otherwise.

I also like to point out that not only Disk Utility's "Disk Repair" failed to fix the issue but also Disk Warrior, which is supposed to rebuild the entire catalog, didn't fix the issue. If these issues would occur more frequently, I'd surely consider writing a software to take care of this... But it has to pay as writing software is what I make a living of, and I don't think people need such a tool too often, do they? OTOH, if I see how well that rather trivial "Disk Doctor" in the App Store sells, I could cry.
 
Last edited:
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Everyone, you can stop making suggestions. The names are indeed corrupted, to the point where OSX cannot translate the names properly into unicode any more, hence any operation that tries to address the files by name will internally fail - that's why trying to delete or rename them won't work at that level.

I know this because I've now looked at the disk using iBored, finding the corrupted entries, containing control chars and even Backspace chars in their name. They appear to be a result from recovering files and folders with Disk Rescue 3, with the effect that DR3 did not clean up the bad names that were - apparently, never meant to be files in the first place (meaning DR3 recovered data that it believed to be directory entries which were, in fact, not).

I have now started fixing the bad names and am in the middle of improving iBored to the point to make this easier in the future.

This is why I suggested using inode.
 
Joined
May 19, 2009
Messages
8,428
Reaction score
295
Points
83
Location
Waiting for a mate . . .
Your Mac's Specs
21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
Very good too see that the issue is resolved. Very nice App too, and worth the very cheap price. One thing I would like to see in the Context Menu, is 'Copy Path' . . . .

Glad it has all worked out well.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top