Undeletable nested folders in Trash - Terminal expert please??

Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
This is why I suggested using inode.
You wrote earlier to remove the dir by iNode instead of by file name. That would have been worth a try, indeed. But how to do do that? The "rm" terminal cmd doesn't seem to offer the option to specify a file by inode number, or does it?
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
One thing I would like to see in the Context Menu, is 'Copy Path' ..

You're talking about Find Any File? It's there - just hold down the Option key while you open the Edit menu.

And right-clicking on the text (where it shows the current path) at the very bottom lets you copy the path as well.

And holding Shift in the Edit menu copies only the file names, and holding Ctrl+Shift copies only the names and indents them as they appear in the hierarchical view.
 
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.
You wrote earlier to remove the dir by iNode instead of by file name. That would have been worth a try, indeed. But how to do do that? The "rm" terminal cmd doesn't seem to offer the option to specify a file by inode number, or does it?

Not by itself, but the find command makes it doable.

to find the inode number...


cd .Trash; ls -i

$ cd .Trash/
.Trash $ pwd
/Users/foo/.Trash
$ ls -i
7573770 foo


Now, the number to the left is the inode. So we can leverage find to delete. I never issue the delete command without a test. (ok, that's a lie.. I do.. but you really shouldn't)

find . -inum 7573770

$ find . -inum 7573770
./foo
.Trash $


Now that we know for sure that we have the right file (or dir)

find . -inum 7573770 -exec rm -rf {} \;

viola.

.Trash $ find . -inum 7573770 -exec rm -rf {} \;
.Trash $ ls -a
. ..
.Trash $
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
find . -inum 7573770 -exec rm -rf {} \;

viola.
That won't work because the find command still uses file paths to address the files in the end. And if the file path contains bad chars, this still can't work.

Oh, and it's voila (or,even better voilà) ;)
 
Joined
Oct 16, 2010
Messages
18,177
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
… …
… ...

Oh, and it's voila (or,even better voilà) ;)


Ah relief...!! And here I was trying to figure out what sort of programming language that was or it was meant to represent the sweet sound of success represented with mellow string sounds. ;)
 
Joined
Apr 4, 2015
Messages
10
Reaction score
2
Points
3
Ah relief...!! And here I was trying to figure out what sort of programming language that was or it was meant to represent the sweet sound of success represented with mellow string sounds. ;)
Yeah. That attention to detail makes me a good programmer but also quite the smart *** - I just can't resist it.
 
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
You're talking about Find Any File? It's there - just hold down the Option key while you open the Edit menu.

And right-clicking on the text (where it shows the current path) at the very bottom lets you copy the path as well.

And holding Shift in the Edit menu copies only the file names, and holding Ctrl+Shift copies only the names and indents them as they appear in the hierarchical view.

Ahh got it, thanks. I was expecting it to be in the Context Menu, once you Right click the site Searched.
All good, cheers.
 
Joined
Oct 16, 2010
Messages
18,177
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
Yeah. That attention to detail makes me a good programmer but also quite the smart *** - I just can't resist it.


My son hired an excellent proofreader when he was starting a small startup and she was excellent and meticulous, and not a smart*** at all. In fact very nice. ;)

But I'm afraid to ask what the part of the posters sig above means …:
"Got # ? phear the command line! "

Some sort of code or…???
 
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.
That won't work because the find command still uses file paths to address the files in the end. And if the file path contains bad chars, this still can't work.

Oh, and it's voila (or,even better voilà) ;)

I've been using pretty much that same logic for years for files named things like . and .. ;) Both are invalid characters.. (we're not establishing a variable when using -exec)

On I certainly typoed voila..
 
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.
My son hired an excellent proofreader when he was starting a small startup and she was excellent and meticulous, and not a smart*** at all. In fact very nice. ;)

But I'm afraid to ask what the part of the posters sig above means …:
"Got # ? phear the command line! "

Some sort of code or…???

When your prompt is # you are logged in as root. Oh and there is otherwise far too much fear of the command line in general. It's simple, has been around (well documented and largely untouched) for decades. Longer than me, that's for sure.. and I started on TTYs.
 

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