Questions about deleting user folder and another about trash bin

Joined
Jan 17, 2006
Messages
31
Reaction score
1
Points
8
Location
Beverly, Massachusetts
Your Mac's Specs
2011 MacBook Pro; 8GB RAM; 256GB SSD; 27" Thunderbolt Display
I've got a folder in my user folder, well I have a few; my real one, the one called 'shared', and a third one I accidentally made.

I want to delete this third one, but everytime I drag it to the trash barrel, I get the following: "The operation cannot be completed because you do not have sufficient privileges for some of the items."

Fine, so I 'get info' and set all permissions to read and write for me; I am the only admin and only user on the whole computer...

Still won't let me delete this folder. It appears to be empty, but when I 'get info', there is 15.8 MB of something in there...

Any ideas?

--------------------------------------------------

Also, when I delete anything, I get the box which announces that my file-to-be-deleted will skip the trash bin and go away. Where can I find the setting where items actually DO go to my trash bin?
 
K

Kokopelli

Guest
Again, there may be an easier way but...

To find out what is in the directory:
open a terminal and go into the dirstory in question then to a "ls -a" it is possible that there are some invisible or hidden files in there. They should all show up in teminal though.

to force deletion of the directory:
"cd ~" to go back to your home directory. "sudo rm -rf ./<directory name>" replacing <directory name> with the directory you want to get rid of. Warning #1: This permanently deletes the files, it does not send them to trash. Warning #2: Make sure you type the command correctly, this is being executed as root.

If you just want to send the directory to trash:
"sudo mv ./<directory name> ./.Trash" Which will move it to trash, but you will have to force clear trash to get rid of it probably.

EDIT: Can you create a test document and then drag that to trash? I wonder if it is the trash can that is the problem or the directory you want to delete.
 
OP
H
Joined
Jan 17, 2006
Messages
31
Reaction score
1
Points
8
Location
Beverly, Massachusetts
Your Mac's Specs
2011 MacBook Pro; 8GB RAM; 256GB SSD; 27" Thunderbolt Display
Kokopelli said:
If you just want to send the directory to trash:
"sudo mv ./<directory name> ./.Trash" Which will move it to trash, but you will have to force clear trash to get rid of it probably.
This did it! Thanks...

It was a bit funny to see this when following your instructions:

"We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility."

Ah the power of Terminal. On a side note, are there any sites/guides I can read which will talk to me like I've never been in Terminal before?

So I'm just left with the small dilemma of why my files-to-be-deleted skip my trash bin. Any ideas?
 
K

Kokopelli

Guest
herkalees said:
It was a bit funny to see this when following your instructions:

Yes that is because you were running the command as "root" something to be done with caution unless you know what you are doing, thus my warnings. The risk in a move (mv) is minimal so I left it be. At worst we would have to move the file back to the right location.

herkalees said:
Ah the power of Terminal. On a side note, are there any sites/guides I can read which will talk to me like I've never been in Terminal before?

Ironcially this is the third time I have been asked this in a week. I will dig up some resources and post a thread. In general terms the terminal is a BASH shell, so most resources explaining the use of BASH should do. There are minor quirks to each platform (Linux, OS X, BSD, AIX, etc...) but generally they don't come up much, mostly a command missing here and there.

herkalees said:
So I'm just left with the small dilemma of why my files-to-be-deleted skip my trash bin. Any ideas?

Yes, that is why I suggested creating a file and seeing if you could drag that file into the trash.

If you want to check what I suspect (that your trash is set to a different owner) open a terminal and type "ls -la | grep Tra*" and make sure it lists something like this:

drwx------ 2 <username> <username> ... .Trash

the important parts are "rwx" meaning you have read, write, and execute rights, and "<username> <username>" being the owner of the folder.

I qualify all this with my classic caveat. I am a command line junkie, there may be an easier way with the GUI but if there is I do not know it. Perhaps someone else can help there.

----------------------
P.S. As a first lesson "ls -la | grep Tra*"
ls => list files
-la => list details and list all files including hidden ones
| => use the output of the command on the left of | (pipe) as the input to the command on the right
grep Tra* => print only lines that match the pattern Tra*

thus we listed all the files in a directory but only printed the ones with Tra in the line as output.
 
OP
H
Joined
Jan 17, 2006
Messages
31
Reaction score
1
Points
8
Location
Beverly, Massachusetts
Your Mac's Specs
2011 MacBook Pro; 8GB RAM; 256GB SSD; 27" Thunderbolt Display
I made a new, empty folder on the desktop, then dragged it to the trash bin; it resulted in the same thing: it skipped going into the trash bin.

I did what you said above, and here is the result in Terminal:
drwx------ 3 root admin 102 Mar 4 09:42 .Trash

I'm confused, but uneducated. My username in Preferences > Users is "Marc Amos" and it is definitely admin, and the only one. In Finder, the Home folder is called "marcamos", and the computer named it this by itself.

I'm guessing that I should see "marcamos" as an owner in that string output from terminal? No?

Ha, thanks for helping, I'm such a point-and-click n00b.
 
K

Kokopelli

Guest
OK that is wrong. .Trash should not be owned by root and it is the root of your problem (pardon the pun). While you are the admin of the machine what you are seeing there is the admin group, which no normal user is part of.

do a "ls -l ~" the majority should have two columns with that repeat eah other, that should be your user name, in your case "marcamos".

In a normal folder you could get info for the folder by right clicking, then change the owner in the ownership and permissions at the bottom. We will do it via command line.

first lets make sure we are in home
"cd ~"

now we will chang the owner of trash and everything in it to you.
"sudo chown -R marcamos:marcamos .Trash"
this assumes your user name is marcamos, which you would have confirmed earlier. Again we are using sudo, so show the command the respect it deserves and make sure you type it in correctly.

That should fix it.

EDIT: Explanation of the ls output you had before:
drwx------ 3 root admin 102 Mar 4 09:42 .Trash

"drwx" it is a directory and the owner of the directory has read, write, and execute priviledges. (Execute for directories allows you to get a file list of contents)
"---" the group who owns the direcotry has no access.
"---" everyone else also has no access.
Thus only the owner of the direcotry has any access

"3" there are three files the directory
"root admin" the owner is root, the owning group is admin. (in this case the group really does not matter since the group has no access)

The rest is date and the directory name.
 
OP
H
Joined
Jan 17, 2006
Messages
31
Reaction score
1
Points
8
Location
Beverly, Massachusetts
Your Mac's Specs
2011 MacBook Pro; 8GB RAM; 256GB SSD; 27" Thunderbolt Display
Ha, you're my new best friend. It worked!
 
OP
H
Joined
Jan 17, 2006
Messages
31
Reaction score
1
Points
8
Location
Beverly, Massachusetts
Your Mac's Specs
2011 MacBook Pro; 8GB RAM; 256GB SSD; 27" Thunderbolt Display
One last question (unrelated). I'm sure there is a command which will allow me to take the contents of one folder and compare it to the contents of another, and then only move what the first folder has into the second.

For instance:
- Folder1 has the following in it: red.jpg, blue.jpg, yellow.jpg, green.jpg
- Folder2 has the following in it: blue.jpg, green.jpg

How can I make the computer look at the contents of each, determine that Folder2 has some, but not all of the same files, and have it copy those which is doesn't have over?

I'm actually looking to do this on a 10gb folder of MP3's, but the above makes it easy to consider. I have about 10gb of MP3s on my external backup drive, and when copying them ALL over to my mac, it had a small error (just now actually) and only got some of them over.

Is it easier to just 'select all, copy, paste' and choose 'yes' to overwriting the files which already exist? I assume that will just take forever, which is why I asked about some sort of 'compare' command which might exist.

Thanks again!
 
K

Kokopelli

Guest
An interesting question...
This is not thoughly tested. I am reasonably certain it is right and it works right in my simple tests. On the other hand I don't want to be responsible for wiping your iTunes library, so backup the destination folder before you do this.

assuming the folders have the same directory structure:

"cp -Rn <original directory>/ <destination directory>"

cp => copy

-Rn => recurse down subdirectories and do not overwrite existing files

<original directory>/ => all the files in the original directory. The ending / is important else it will include the parent directory

<destination directory> => where to send it (no following slash)

So as an example "cp -Rn ~/myNewDocs/ ~/Documents" would copy all files in myNewDocs that did not already exist in Documents.

Alternatively you could use something like Chrono Sync. That is true synchronization though and not exactly what you are asking for. Caveat: I have never used this program, but there is at least one person on these forums who does and seems happy with it. If you want to synchrinize, or even just hae a spiffy GUI, this seems like a good choice.

I use subversion for some folders, but that is well beyond what I would recommend for most people. I used to use Unison which is free and a good fit, but I can't find the OS X native code for it on the web (the link is dead).
 
OP
H
Joined
Jan 17, 2006
Messages
31
Reaction score
1
Points
8
Location
Beverly, Massachusetts
Your Mac's Specs
2011 MacBook Pro; 8GB RAM; 256GB SSD; 27" Thunderbolt Display
Thanks a ton man, this should be great
 

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