 |
 |
unlink/delete file
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2002
Status:
Offline
|
|
I have a file/folder in my trash from a separate hard drive. I cannot empty it in the trash because it is "locked". I am logged in as root, but I cannot empty it because I don't have "permission". I have attempted ALL the "empty Trash" programs there are out there, but none will do the deal...
Finally, I started trying to empty it from the terminal (being assured by a versiontracker ref. that this would ABSOLUTELY do it), but was again told that I was either performing an "illegal operation", or didn't have "permission" (or both) and to "unlink" the file first. Well, I went to the man page to reference unlinking a file, but I'm not understanding how to use the commnd ().
Does any one have any suggestions, ideas, insights, or solutions???
I have had this thing in my trash for over a month now and still haven't figured out how to elininate it!

|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status:
Offline
|
|
Originally posted by nuventure:
I have a file/folder in my trash from a separate hard drive. I cannot empty it in the trash because it is "locked". I am logged in as root, but I cannot empty it because I don't have "permission". I have attempted ALL the "empty Trash" programs there are out there, but none will do the deal...
Finally, I started trying to empty it from the terminal (being assured by a versiontracker ref. that this would ABSOLUTELY do it), but was again told that I was either performing an "illegal operation", or didn't have "permission" (or both) and to "unlink" the file first. Well, I went to the man page to reference unlinking a file, but I'm not understanding how to use the commnd ().
Does any one have any suggestions, ideas, insights, or solutions???
I have had this thing in my trash for over a month now and still haven't figured out how to elininate it!
Try:
sudo rm -Rf /path/to/folder
Be VERY careful with that command! An inadvertent space such as:
sudo rm -Rf / path/to/folder
will wipe your entire system... and it won't ask you if you really want to do it or not. Somewhat safer way to use it is:
cd /path/to/
sudo rm -Rf folder/
|
|
-DU-...etc...
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status:
Offline
|
|
Uh, it would be safer to (in Terminal)
cd ~/.Trash (assuming in your home trash)
ls -al (confirm the offending file is there)
rm -f filename
if that fails
sudo rm -f filename
Mike
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2002
Location: London
Status:
Offline
|
|
Originally posted by nuventure:
I have a file/folder in my trash from a separate hard drive.
If the file/folder is from a separate hard drive, it is probably not in your ~/.Trash folder, but in /Volumes/someVolume/.Trashes/501 (or whatever your UID is).
If you can't get rid of it, it may be locked. To find out what is going on, type these commands (cut and paste one line at a time) and post your results:
Code:
ls -aolR .Trash
ls -aolR /Volumes/*/.Trashes/`id -u`
This may help to identify the problem.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2002
Status:
Offline
|
|
Actually, it IS a locked file in the trash of another volume (PLUS its invisible, PLUS it has a "+" character in ithe file's name!
Double Help!!
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status:
Offline
|
|
Originally posted by nuventure:
Actually, it IS a locked file in the trash of another volume (PLUS its invisible, PLUS it has a "+" character in ithe file's name!
You can unlock a file from the command line with the following:
sudo chflags nouchg <filename>
Of course you don't need sudo if you own the file but in that case you could unlock it in the Finder. If you have Apple's Developer Tools, the SetFile command can also be used to unlock files. To do any of this from the command line, you must know exactly where the file is and given that the Trash is actually a collection of directories, this can be problematic. The easiest way to get the exact path is simply drag the file to the Terminal. However, there are also AppleScript commands that will return the POSIX path to the file.
|
|
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jul 2002
Location: Leiden, Netherlands
Status:
Offline
|
|
Originally posted by nuventure:
Actually, it IS a locked file in the trash of another volume (PLUS its invisible, PLUS it has a "+" character in ithe file's name!
Double Help!!
Use the rm method given above. You need to protect the filename with ' ' in order to get rid of the "+" annoyance.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status:
Offline
|
|
Originally posted by Ludovic Hirlimann:
Use the rm method given above. You need to protect the filename with ' ' in order to get rid of the "+" annoyance.
Why? What shell considers a "+" to be a special character in a filename?
|
|
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|