Justin
Justin

Reputation: 1479

Why am I getting "Directory not empty" error in terminal when using rmdir?

I am walking through a tutorial and it lets me delete two directories (I'm using one 10 deep, all empty) but once I try to remove the third it gives me that error message, even though there is no content in the directory and I am in the directory above it. Why is this? By the way I am using terminal.

Upvotes: 5

Views: 31598

Answers (3)

Veve
Veve

Reputation: 6748

On Windows I recently has the same problem, and deleting everything in {UserFolder}\AppData\Local\Composer\files didn't helped.

What I've done is to launch multiple times the composer install --dry-run command until it listed all dependencies, then I successfully ran the composer install command.

Upvotes: -1

verunar
verunar

Reputation: 874

you can remove all hidden files by using rm -R ./.* you have to be in the directory the hidden file is in for it to work

Upvotes: 2

verdammelt
verdammelt

Reputation: 942

That error is reported when the directory is not empty.

To find out what files are in that directory use ls -a. The -a flag tells ls to list hidden files (aka "dot files"). Remove those files then rmdir can be used.

Another option is to simply use rm -rf to recursively delete the directory and all of its files. NOTE: this can be dangerous if you give the wrong parameters - resulting in deleting more than you intended.

Upvotes: 6

Related Questions