Why can't I delete these folders?
September 13, 2010 3:37 PM   Subscribe

I'm unable to delete (apparently) empty folders from my Mac. Opening them grinds the system to a halt and even looking at them through the terminal nearly crashes the machine.

I had an old pirated copy of Civ IV (yes, yes, I'm a bad person and this is my punishment, but I'm trying to delete the thing, so help me out?) and there are a few folders that were in my documents subfolder that I can't get rid of or even open in finder. Looking through them (using ls and ls -a) in terminal allows me to do so, but there is a incredible slowdown when I do so. Also, when I do run ls or ls -a, I just get back what looks like an empty folder. When I tried to delete them using rm -rf I got an error message back saying that the folders were not empty. When trying to delete them via the trash, I run into the error that the folders (not any file in them, but the folders) are in use.

What am I doing wrong and how to I clean these last vestiges off my machine?

Running 10.4.11 on a Macbook Pro.

If any more information is needed, please let me know and I'll provide it.
posted by Hactar to Computers & Internet (11 answers total) 1 user marked this as a favorite
 
Best answer: Could be some sort of filesystem corruption. Run Disk Utility, do a "Verify Disk", and see if it says anything needs to be repaired.
posted by xil at 4:09 PM on September 13, 2010


sudo rm -rf "PIR8CIV4WAREZ/"
posted by Threeway Handshake at 4:38 PM on September 13, 2010


Response by poster: Threeway Handshake:
sudo rm -rf CustomAssets
Password:
rm: CustomAssets/art/leaderheads: Directory not empty
rm: CustomAssets/art/movies: Directory not empty
rm: CustomAssets/art/structures: Directory not empty
rm: CustomAssets/art: Directory not empty
rm: CustomAssets: Directory not empty
xil:
I'll do a verify disk while I'm making dinner.
posted by Hactar at 4:45 PM on September 13, 2010


Seconding Threeway Handshake and Hactar - worked for me with a recalcitrant PDF a once.
posted by digitalprimate at 6:08 PM on September 13, 2010


Response by poster: digitalprime:
seconding what? sudo didn't work for me.
posted by Hactar at 6:40 PM on September 13, 2010


Try sudo chmoding it first? 777 would be good. rm -rf won't work if it's write-protected iirc.
posted by kthxbi at 10:07 PM on September 13, 2010


(with the -R option, in case that isn't clear. So `sudo chmod 777 -R CustomAssets`)
posted by kthxbi at 10:12 PM on September 13, 2010


Best answer: I second the idea of running Verify Disk (aka fsck).

It doesn't sound like a permissions problem. You'd get at least one "permission denied" error before the "not empty" errors if it were (and sudo rm -rf should work).
posted by hattifattener at 11:13 PM on September 13, 2010


Perhaps if rm -rf is being stupid (it will do that if there are files that start with - in the path - iirc rm -rf -- [path] usually works there), but maybe this would work:

sudo "find CustomAssets -type f | xargs rm -f"
sudo rm -rf CustomAssets

The first one deletes files individually (ish) instead of trying to generate a huge match which might overflow, and the second one deletes the directory structure that remains. If you aren't certain you're limiting yourself to the directory you intend, something like the following will show you what you'll delete with the first command:

sudo "find CustomAssets -type f | xargs echo"

But that should work. Alternately, you may have a pretty subtle permissions problem - files can have ACLs at least as far back as 10.4, which also includes stuff like "undeletable" and so forth. The ACLs are controlled by chmod, and there's some special magic for ls that allows you to see them. Normal users don't make them, but I wouldn't be surprised if the release group intentionally tweaked the ACLs to defeat the copy protection.

Standard Disclaimer applies: If you delete your hard drive, you're on your own.
posted by Kyol at 9:00 PM on September 14, 2010


Response by poster: Ran the verify disk- my hard drive needs repairs. Going to back up the drive and then repair it. One final question if anyone is reading this- for some reason the "repair drive" button is grayed out. Any suggestions? Is there a unix command to repair the thing?
posted by Hactar at 12:55 AM on September 15, 2010


Best answer: I think you can't repair a filesystem (volume) that's mounted, which is a problem if you have to repair the boot volume, because you can't unmount that one. The OS install disks have a copy of Disk Utility on them, though; you can boot from them, and instead of installing, run the repair procedure on your hard disk (which, since you didn't boot from it, will just be some random other disk as far as the system's concerned).
posted by hattifattener at 12:45 AM on September 17, 2010


« Older Irritation Nation   |   Continuous bleeding since pregnancy began? Newer »
This thread is closed to new comments.