Techsurvivors

Archives => 2006 => Topic started by: Jack W on July 02, 2006, 07:08:25 PM

Title: Delete Locked Files
Post by: Jack W on July 02, 2006, 07:08:25 PM
I've got a new phenomenon  since updating to Tiger 10.4.6+.

When I try to move a locked file to the trash, or delete, Tiger won't let me do it.

In Jag, I could move to Trash, and then Option-delete.

Is this just me? Or is this a new "Feature" introduced in Tiger?

- Jack
Title: Delete Locked Files
Post by: Xairbusdriver on July 02, 2006, 07:47:26 PM
Not sure how you even got a locked file into the Trash! I locked a useless file on the Desktop and I couldn't drag it into the Trash! I was able to lock a copy of the unlocked file I put in the Trash, however.

I could empty using control-click the file and selecting "Empty". However, I could also use command-shift-delete!

Since I use iCan, I also could empty a locked file by option-clicking the icon and selecting the plain "Empty" choice. There is also a "Smart Empty" selection that I have used when the OS says/thinks a file in "In use".
Title: Delete Locked Files
Post by: MamaMoose on July 03, 2006, 02:21:43 AM
Jack,

I believe there are other software solutions to deleting locked files. I use Trash it! 3.6.1. Try it and see if it works fore you.

MamaMoose
Title: Delete Locked Files
Post by: Parker on July 13, 2006, 11:33:39 PM
option+apple+shift+delete
force empty trash
deletes everything
locked or not
Title: Delete Locked Files
Post by: Jack W on July 14, 2006, 10:11:40 AM
parker,

But, can you put that in an Applescript command line?
Title: Delete Locked Files
Post by: Parker on July 14, 2006, 01:22:41 PM
i don't have much experience with the command line
only thing i know how to do is unhide and rehide hidden folders.

genius bar showed me a little bit of console the other day.

-parker
Title: Delete Locked Files
Post by: Xairbusdriver on July 14, 2006, 06:51:48 PM
From your original question in the thread you started...
QUOTE
I've got a new phenomenon  since updating to Tiger 10.4.6+.
 
 [1] When I try to move a locked file to the trash, or delete, Tiger won't let me do it.
 
 [2] In Jag, I could move to Trash, and then Option-delete.
 
 [3] Is this just me? Or is this a new "Feature" introduced in Tiger?

 [1], [3] True, Tiger won't allow you to move a locked file to the Trash. It's a 'feature' not a bug! wink.gif
 [2] Now you must unlock the file before putting it in the Trash. But even if a Locked file gets into the Trash somehow, you can Delete it with shift-command-delete.
 
 For some reason I can't use the "Fast Reply" button in that thread. dntknw.gif Thinking.gif

There is both a "delete" and an "empty" verb in the Finders AppleScript dictionary. "delete" actually just moves an object to the Trash. "empty" ( and "empty trash" ) is simply defined as "Empty the trash". No word on whether there is any limits on what can be moved or about the "locked" state of those objects. So, you don't need to enter any commands, just use the verbs supplied ( and see what happens! ).
Title: Delete Locked Files
Post by: krissel on July 14, 2006, 09:33:04 PM
testing Fast Reply...
Title: Delete Locked Files
Post by: Parker on July 14, 2006, 11:34:27 PM
there's a Automator command to unlock files

http://www.apple.com/downloads/macosx/auto...andfolders.html
Title: Delete Locked Files
Post by: sandyman on July 15, 2006, 06:09:32 AM
Open the terminal
type
sudo rm -f
drag the file to the terminal window
enter your (admin) password when asked.

I've set up F16 to open Terminal as I use it a lot
Title: Delete Locked Files
Post by: D76 on July 15, 2006, 07:45:29 AM
QUOTE(sandyman @ Jul 15 2006, 07:09 AM) <{POST_SNAPBACK}>
type
sudo rm -f
drag the file to the terminal window
enter your (admin) password when asked.
My machine sticks its tongue out and says "illegal option."
Title: Delete Locked Files
Post by: Jack W on July 15, 2006, 09:33:09 AM
gailwin and sandyman,

As I stated, the problem occurs in an Applescript.

The command line where the error occurred:

delete every item of folder "Backups:Backup:Applications"

The recalcitrant file was a Safari History file that had been locked intentionally to keep it "clean". But I understand that in Tiger Safari, you can get it to empty when you close Safari.

So anyway I unlocked it and all is fine now in this particular instance.

I guess Apple thinks they need to protect us from ourselves. And I guess they are right.

Jack
Title: Delete Locked Files
Post by: kps on July 15, 2006, 09:44:55 AM
rm -rf can fail with locked files. Some locked files need to be unlocked first.

Unlocking the files command:

chflags -R nouchg,noschg *

to find locked files in a folder use:

ls -lo

then:

sudo chflags -R nouchg,noschg folder_name

to trash:

sudo rm -Rf folder_name

Good idea to read up on the use of chflags in the man pages before using the command.
Title: Delete Locked Files
Post by: bobw on July 15, 2006, 10:13:50 AM
QUOTE(D76 @ Jul 15 2006, 08:45 AM) <{POST_SNAPBACK}>
My machine sticks its tongue out and says "illegal option."



Open the Terminal Application (in Utilities folder) and type:

cd ~/.Trash
    hit return

then type;

sudo rm -rf

put a space after the f and drag the item you want deleted to the terminal so that its path is automatically entered, then press return

give it your admin password and hit return
Title: Delete Locked Files
Post by: pendragon on July 15, 2006, 10:33:03 AM
If you choose to avoid Terminal, Cocktail can easily delete locked or inaccessible files:

1. Launch Cocktail
2. Select the Files tab/pane
3. Navigate to (Choose) the file you wish expunged, click OK, and voilĂ ! clap.gif

I presume OnyX also has this capability.

AFAIK, this always works, but I suppose there are exceptions. dntknw.gif
Title: Delete Locked Files
Post by: D76 on July 15, 2006, 01:07:01 PM
Thanks everyone for your replies.
Title: Delete Locked Files
Post by: Xairbusdriver on July 15, 2006, 05:25:45 PM
QUOTE(kps @ Jul 15 2006, 09:44 AM) <{POST_SNAPBACK}>
rm -rf can fail with locked files. Some locked files need to be unlocked first.

Unlocking the files command:

chflags -R nouchg,noschg *

to find locked files in a folder use:

ls -lo

then:

sudo chflags -R nouchg,noschg folder_name

to trash:

sudo rm -Rf folder_name

Good idea to read up on the use of chflags in the man pages before using the command.
And then there is the slightly less conveninet method of using command-i and un-clicking the "Locked" check box...of course, this is not nearly as 'thrilling' as using Terminal. harhar.gif
Title: Delete Locked Files
Post by: D76 on July 15, 2006, 05:39:54 PM
Terminal is nothing, if not thrilling. Anything beyond sudo periodic daily weekly monthly has me on the edge of my chair. sweatingbullets.gif
Title: Delete Locked Files
Post by: kps on July 15, 2006, 06:52:36 PM
QUOTE(airbusdriver @ Jul 15 2006, 06:25 PM) <{POST_SNAPBACK}>
And then there is the slightly less conveninet method of using command-i and un-clicking the "Locked" check box...of course, this is not nearly as 'thrilling' as using Terminal. harhar.gif


Thrilling, schmilling...

Have fun doing that on each file in a folder with hundreds of locked files...or good luck with any system locked file. Root your way out of that one... tongue.gif

The big R is for recursive, the noschg is for system bits.

There is a reason I post these things...

Remember Jim ...the Terminal is your friend!  laugh.gif salute.gif
Title: Delete Locked Files
Post by: Dreambird on July 15, 2006, 07:12:09 PM
rofl.gif

Thanks kps... you have NO idea how much I needed a good laugh!

No offense ABD... it just tickled the right funny bone... wink.gif
Title: Delete Locked Files
Post by: Xairbusdriver on July 15, 2006, 09:01:47 PM
QUOTE
the Terminal is your friend!
You obviously weren't travelling with me or my wife the last few weeks! Neither of us wants to see another Terminal for several months! And who says you should be deleting System Locked files?! eek2.gif
Title: Delete Locked Files
Post by: krissel on July 16, 2006, 01:14:26 AM
Reminds me of the packet of sugar I got at a restaurant many years ago labeled "Terminal Food Service".

 eek2.gif
Title: Delete Locked Files
Post by: kps on July 16, 2006, 04:27:26 PM
QUOTE(airbusdriver @ Jul 15 2006, 10:01 PM) <{POST_SNAPBACK}>
You obviously weren't travelling with me or my wife the last few weeks! Neither of us wants to see another Terminal for several months! And who says you should be deleting System Locked files?! eek2.gif


I had an instance where an old folder with hundreds of clipart got locked and nothing...and I mean nothing would work to unlock and delete the items.

My (and your) friend the Terminal made short work of it.

There are also instances where trashed items on external drives get locked or the trash folder gets corrupted and the shell is the only way to deal with it.

Tiger might have resolved some trash issues from previous versions, but you never know. Pretty soon, Jim, you may not be able to boot into OS 9 and delete files in X. laugh.gif
Title: Delete Locked Files
Post by: Xairbusdriver on July 17, 2006, 02:29:01 PM
What's OS 9?! harhar.gif

And here's another reason to use Terminal, if you've upgraded to 10.4.7, anyway.
<Widgets Calling Home!> Might be good to know about this 'feature' with strange processes going on behind your back!