Unable to delete a file whatever I do

Joined
Jul 21, 2020
Messages
1
Reaction score
0
Hey, everybody
I'm going crazy with this
I have plugged an external HD on my macbook and am trying to delete some stuff there are 2 folders that wont delete no matter what. I've had the same problem with the same folder in a BKP HD, I had to format that one so that the trash would be empty again. I cannot do the samething with this one bc i dont have enought storage space to make a backup.

I've tried everything: sudo rm -ri -rf -r none of them worked. I've tried moving the file to temp folder, nothing there either.
When I tried the sudo rm command I got the message : directory not empty
when I try to empty the trash I get: file in use error

Pls help me?
I'm running High Sierra on a macbook pro from late 15.
Both the external HDs are formated on ExFat

Thx.
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,106
Reaction score
497
Hello and welcome.

Part of the issue may be that the drives are formatted as ExFAT. Do you use them with Windows PCs? If not, I would suggest copying the data to another drive, then reformat them as GUID - MacOS Extended (Journaled), if they won't be used as a startup disk.

You mentioned you don't have enough space on another drive to make a backup, so you may need to navigate fully into each directory/folder in Terminal, delete all files in them, then delete the directories/folders when they are empty. Also, you might want to disable Spotlight on the drives while you are addressing the issue.

C
 
Joined
Mar 2, 2016
Messages
89
Reaction score
1
You say you've tried everything, but you don't say what "everything" includes, so I don't know what you've tried.

- Can you even move the file to the wastebasket? This of course doesn't delete it but merely puts the file in a different directory structure. If you can do this, then open wastebasket, select the file to delete, right-click on it, and select "Delete immediately". That's how I've gotten by these types of errors in the past.

- If that doesn't work, can you overwrite the file, e.g., "echo x > file.in.question"? If this works, the file will still remain, but it will be a lot smaller.

- Since you say the directory is on an external hard disk, do you have access to another PC to see if it can be deleted there?

If not, then it seems like a "file-in-use" bit must be set somewhere (perhaps in the inode?) and the only suggestion I can offer is one you've already done: to evacuate all the files you can off the disk, then format it. Another possibility is to search for some disk utility tools which may address the issue. I don't know of any offhand, but I'm pretty sure you're not the only one with this problem, and that somewhere, probably, someone has invented a solution for this by now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top