Deleting a protected file

iKwak

Registered
I have a folder that contains .rtf files.
When I put the folder to trash and try deleting it,

"The operation cannot be completed because the item "File Name" is locked."



How can you empty the trash? Thank you in advance.
OS: Panther 10.3.9
 

barhar

Registered
01. Launch 'Terminal' ('/Applications/Utilities/'), and enter 'rm -rf ' (yes, add a space after 'f' in '-rf'; but, excluded the single quote marks).
02. Drag the folder containing the '.rtf' files onto the 'Terminal' window.
03. Click on the 'Terminal' window, and press the <return> key.

Warning:
'rm -rf ...' is dangerous and quite destructive. Use it cautiously.
 

Mikuro

Crotchety UI Nitpicker
You can also do it in the Finder by holding down the Option key while selecting "Empty Trash" from the Finder menu. This will immediately empty the trash (without the usual warning), even if it contains locked files.
 

barhar

Registered
MacOS X 10.4.0 trials:

A file was duplicated (titled 'guru copy.hqx'), and via it's 'Get Info' window - was locked.
Whether the <option> key was pressed or not, as the file was dragged onto the 'Dock' based 'Trash can' icon, this message appeared - 'The operation cannot be completed because the item "guru copy.hqx" is locked'. Unlocking the file allowed it to be placed into the trash can and deleted.

A file was duplicated (titled 'guru copy.hqx'), and via it's 'Get Info' window - was locked, and placed into a folder (titled 'Guru') - that was not locked.
When the folder was dragged onto the 'Dock's 'Trash can' icon, it was accepted, and could be deleted via 'Finder's 'Finder, Empty Trash' menu item. (Go figure, Apple!)

A file was duplicated (titled 'guru copy.hqx'), and via it's 'Get Info' window - was locked, and placed into a folder (titled 'Guru') - that was then locked.
When the folder was dragged onto the 'Dock's 'Trash can' icon, this message appeared - 'The operation cannot be completed because the item "Guru" is locked'. Unlocking the folder allowed it, and its contents, to be placed into the trash can and deleted.

A file was duplicated (titled 'guru copy.hqx') and left unlocked, and placed into a folder (titled 'Guru') - that was then locked.
When the folder was dragged onto the 'Docks 'Trash can' icon, this message appeared - 'The operation cannot be completed because the item "Guru" is locked'. Unlocking the folder allowed it, and its contents, to be placed into the trash can and deleted.

-----
MacOS X 10.3.9 trials:

A file was duplicated (titled 'guru copy.hqx'), and via it's 'Get Info' window - was locked.
Whether the <option> key was pressed or not, as the file was dragged onto the 'Dock' based 'Trash can' icon, this message appeared - 'The operation cannot be completed because the item "guru copy.hqx" is locked'. Unlocking the file allowed it to be placed into the trash can and deleted.

A file was duplicated (titled 'guru copy.hqx'), and via it's 'Get Info' window - was locked, and placed into a folder (titled 'Guru') - that was not locked.
When the folder was dragged onto the 'Dock's 'Trash can' icon, it was accepted, and could be deleted via 'Finder's 'Finder, Empty Trash' menu item. (Go figure, Apple!)

A file was duplicated (titled 'guru copy.hqx'), and via it's 'Get Info' window - was locked, and placed into a folder (titled 'Guru') - that was then attempted to be locked, it cannot not. The 'locked' check box is dimmed.
To lock the folder, I had to use 'Terminal' - enter 'chflags -R uchg ' drag the 'Guru' folder onto the 'Terminal' window, and press the <return> key. Only then was the folder locked.
When the (now locked) folder was dragged onto the 'Dock's 'Trash can' icon, this message appeared - 'The operation cannot be completed because the item "Guru" is locked'. Unlocking the folder allowed it, and its contents, to be placed into the trash can and deleted.

A file was duplicated (titled 'guru copy.hqx') and left unlocked, and placed into a folder (titled 'Guru') - that was then locked. See above paragraph of how to lock a folder in 'Panther'.
When the folder was dragged onto the 'Docks 'Trash can' icon, this message appeared - 'The operation cannot be completed because the item "Guru" is locked'. Unlocking the folder allowed it, and its contents, to be placed into the trash can and deleted.

----- ----- ----- -----
So, it appears that iKwak's folder, of '.rtf' files (whether the '.rtf' files were locked or not) was locked. Launching 'Terminal' - entering 'chflags -R nouchg ', dragging the locked folder onto the 'Terminal' window, and pressing the <return> key - would have allowed iKwak to unlock the folder and then trash the folder (along with its contents). Using 'Terminal' with 'rm -rf ...' just shortened the process.

Whether running MacOS X 10.3.9, 10.4.0, or 10.4.2 - when a file (or files) and / or folder(s) are locked, regardless of the View type ('Icon', 'List', or 'Column'), a small pad lock symbol will appear at the lower left portion of file's or folder's icon. This should assist those trying to determine which file(s) and / or folder(s) needs to be unlocked, so such item(s) can be deleted.

Reference:
MattJ's 'Terminal's 'chflags -R nouchg ' entries at this NiMUG web page.
 
Top