Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Deleting locked files System
So, how many of you reboot into OS 9 just so you can empty the trash when you've got Finder Locked files in there?

How often does rm -rf fail on you with "Operation not permitted"?

You too can work around these problems with the terminal command:

chflags -R nouchg,noschg *

See the Man page for more info.

[Editor's note: I did this after doing a "cd ~/.Trash" in the terminal, to make sure I was in my trash folder. I haven't had the locked file problem, but for those that have, this could be a huge timesaver. If you'd like to see what it does first, put "echo " in front of the command.]
    •    
  • Currently 3.60 / 5
  You rated: 2 / 5 (5 votes cast)
 
[9,362 views]  

Deleting locked files | 4 comments | Create New Account
Click here to return to the 'Deleting locked files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
a slightly safer script
Authored by: thinkyhead on May 04, '01 02:54:30PM
Place the following script somewhere in your execution path. Name it 'nuke' and chmod u+x on it. When your trash won't empty and you want it gone fast then just type nuke. Use DropScript to make it double-clickable, paste a pretty icon on it, drag it to the dock, and you'll be Master of Trash.


#!/bin/sh

chflags -R nouchg,noschg ~/.Trash/*
rm -rf ~/.Trash/*


[ Reply to This | # ]
Viewing file flags.
Authored by: misaka on Jul 10, '01 08:39:31PM
I thought I might point out that you can view file's flags with the command ls -lo. Here's a sample of the output:

-rw-r--r-- 1 misaka staff uchg 233663 Jun 22 14:26 fink-0.2.1-full.tar.gz
-rw-r--r-- 1 misaka staff - 719064 Jul 1 15:37 Snoopy.sit
-rw-r--r-- 1 misaka staff - 3952640 Jun 25 22:32 xvnc_3.3.3r2_macosx.tar

The 5th column, between the user/group info and the file size, is the flags, you can see that the fink tarball has the 'uchg' flag set.


-- Mishka


[ Reply to This | # ]
how do i do this?
Authored by: g4macuser on Feb 08, '03 11:28:12AM

i understand what the command does but how do i "Place the following script somewhere in your execution path. Name it 'nuke' and chmod u+x on it. When your trash won't empty and you want it gone fast then just type nuke"?

thanks



[ Reply to This | # ]
How to get rid of locked folders/files?
Authored by: jeffeyer on Oct 14, '03 11:16:04PM

I am not able to trash some folders and files with locked symbols on the icons. It stated that I do not have sufficient privileges. (Get Info in General section, the checked locked is grey out.)

I am not familiar using the Terminal. If you have the answer for me, can you tell me step by step?

Thank you.

(Mac OS 10.2.8)



[ Reply to This | # ]