Cannot delete a folder

Fringe28

macrumors newbie
Original poster
Jan 6, 2012
8
0
Hello. So i just bought a new MBA and I moved a folder with songs from my USB to the desktop then i did not need the songs from that folder. I tried deleting it it will ask me for my password and i enter it and i get the trashcan noise but the folder is still there chill'in on my desktop :(. So any idea of how I can delete it. Tried googling this but could not find anything
Thanks in advance!
 

prisstratton

macrumors 6502a
Dec 20, 2011
533
118
Winnipeg, Manitoba, Canada
Maybe some of you deal with stuck directories and files differently, but this is how I deal with them. So, instead of just attacking (as many of you are wont to do), provide an alternative that works for you.

@Fringe28

I do not know your level of computer experience, so either, PAY VERY CLOSE ATTENTION, or disregard as you see fit.

If you are not familiar with using the terminal, please proceed and type VERY carefully. If you are in doubt at any step in the process…….STOP, as there are commands here that can be DESTRUCTIVE.

Open a Terminal Window (if you do not know what this is, STOP, and go no further and report back here on this forum)
You should default to be in your own user directory, to check this, type: "pwd" (without the quotes)
You should see: /Users/YourUserName (for example, if your name is Bob Smith you would see: /Users/bobsmith)
Change directory to the desktop, type: "cd Desktop" (again, no quotes)
You are now in the desktop sub-dir
Check this, type: "pwd"
You should see: /Users/YourUserName/Desktop (or, still using the example from above: /Users/bobsmith/Desktop)
Check the contents to make sure the sub-dir you want to remove is sitting there, type: "ls"
This will list all items on your desktop, look for the sub-dir that you wish to delete
To delete the directory, type: "rmdir yoursubdir" (for example, if your sub-dir is called test the command would be: rmdir test)
If it will not delete, type: "sudo rmdir yoursubdir" (for example: "sudo rmdir test") - you will be asked for a password as you are using the Super User account when you use SUDO (BE CAREFUL)

Note: the sub-dir will not delete if it is not empty

If the sub-dir still contains files (and you know that you want to get rid of them), do the following:

Change directory into the sub-dir, type: "cd yoursubdir" (for example: "cd test")
Again, check where you are, type: "pwd"
You should see (staying with the above examples): /Users/bobsmith/Desktop/test
If you are satisfied that this is the correct location (and make doubly sure, because anything you do here and now is permanent)
To delete all files in the sub-dir, type: "rm *"
Step back one level in the directory tree, type: "cd .."
Now try and delete the sub-dir, type: "rmdir yoursubdir" (for example: "rmdir test")
If it is still being difficult, type: "sudo rmdir yoursubdir" (for example: "sudo rmdir test")

Hopefully by this point you are successful

If a system process is still tied to the sub-dir it might not delete, restart your system and proceed as above (starting over)

Type "exit" to close the terminal
 

Fringe28

macrumors newbie
Original poster
Jan 6, 2012
8
0
Maybe some of you deal with stuck directories and files differently, but this is how I deal with them. So, instead of just attacking (as many of you are wont to do), provide an alternative that works for you.

@Fringe28

I do not know your level of computer experience, so either, PAY VERY CLOSE ATTENTION, or disregard as you see fit.

If you are not familiar with using the terminal, please proceed and type VERY carefully. If you are in doubt at any step in the process…….STOP, as there are commands here that can be DESTRUCTIVE.

Open a Terminal Window (if you do not know what this is, STOP, and go no further and report back here on this forum)
You should default to be in your own user directory, to check this, type: "pwd" (without the quotes)
You should see: /Users/YourUserName (for example, if your name is Bob Smith you would see: /Users/bobsmith)
Change directory to the desktop, type: "cd Desktop" (again, no quotes)
You are now in the desktop sub-dir
Check this, type: "pwd"
You should see: /Users/YourUserName/Desktop (or, still using the example from above: /Users/bobsmith/Desktop)
Check the contents to make sure the sub-dir you want to remove is sitting there, type: "ls"
This will list all items on your desktop, look for the sub-dir that you wish to delete
To delete the directory, type: "rmdir yoursubdir" (for example, if your sub-dir is called test the command would be: rmdir test)
If it will not delete, type: "sudo rmdir yoursubdir" (for example: "sudo rmdir test") - you will be asked for a password as you are using the Super User account when you use SUDO (BE CAREFUL)

Note: the sub-dir will not delete if it is not empty

If the sub-dir still contains files (and you know that you want to get rid of them), do the following:

Change directory into the sub-dir, type: "cd yoursubdir" (for example: "cd test")
Again, check where you are, type: "pwd"
You should see (staying with the above examples): /Users/bobsmith/Desktop/test
If you are satisfied that this is the correct location (and make doubly sure, because anything you do here and now is permanent)
To delete all files in the sub-dir, type: "rm *"
Step back one level in the directory tree, type: "cd .."
Now try and delete the sub-dir, type: "rmdir yoursubdir" (for example: "rmdir test")
If it is still being difficult, type: "sudo rmdir yoursubdir" (for example: "sudo rmdir test")

Hopefully by this point you are successful

If a system process is still tied to the sub-dir it might not delete, restart your system and proceed as above (starting over)

Type "exit" to close the terminal
I did everything you said twice and the folder is still there. The terminal responds with operation could not be completed (or something very similar to this). Any other ideas?
Thanks :)
EDIT: maybe the problem is that i played the songs in to iTunes but after i did not want them anymore i deleted them from iTunes and the folder.
 
Last edited:

LostSoul80

macrumors 68020
Jan 25, 2009
2,136
6
As already stated, try just this:
- open up the terminal, then type "sudo rm -rf " without quotes (see the ending space character)
- drag the folder in the terminal

It will ask for the password. Report any output (though that's unlikely).
 

maflynn

Moderator
Staff member
May 3, 2009
65,504
31,544
Boston
click on the folder to select it, then hit cmd-i to invoke the get info. At the bottom of the get info dialog box it will show you sharing and permissions. What does it show for you?

In the general section near the top, there's a locked check box is that cleared?
 

Attachments

Fringe28

macrumors newbie
Original poster
Jan 6, 2012
8
0
have you tried simply deleting it from within finder?
Yeah tried that even before posting on this forum. I just get the trashcan noise but it doesn't move. The folder is still there
As already stated, try just this:
- open up the terminal, then type "sudo rm -rf " without quotes (see the ending space character)
- drag the folder in the terminal

It will ask for the password. Report any output (though that's unlikely).
Tried this and it says that the operation cannot be completed :/

click on the folder to select it, then hit cmd-i to invoke the get info. At the bottom of the get info dialog box it will show you sharing and permissions. What does it show for you?

In the general section near the top, there's a locked check box is that cleared?
The sharing thing says
-Fringe (Me) - Read & Write
-staff - Read & Write
-everyone - Read & Write
And the box is not ticked. (the folder is not locked)
 

tyche

macrumors 6502
Jul 30, 2010
411
61
Can't understand why rm -rf wouldn't work. Maybe something is holding it open.

Can you mv the directory?

You could try booting into single user mode (cmd-s on startup). If you can't delete the directory some single user mode, you might have disk problems.
 

compooter

macrumors newbie
Jun 12, 2012
1
0
Care to say what finally worked ?

-t
this guy probably had to "unlock" the Desktop directory to allow for changes to occur within the Desktop folder. To clarify, open finder, go to devices, go to mac hdd, go to users, go to your user directory, option click on Desktop folder, click on "get info", make sure the checkbox for lock is unchecked and make sure read write permissions are correct for this folder.