rm: cannot remove `dir-name': Directory not empty

104 Views Asked by At
ls -al .vscode-server

# . .. bin

ls -al .vscode-server/bin
# . ..

I tried to use rm -rf .vscode-server to remove .vscode-server, and got rm: cannot remove 'dir-name': Directory not empty.

I tried to figure out which process is using dir and found no result.

lsof .vscode-server/.
# empty result

So, what can I do to remove .vscode-server?

1

There are 1 best solutions below

1
Seth Grissman On

The rm command cannot remove non-empty directories unless given the recursive flag -r

If you are trying to remove the .vscode-server directory using rm, then you would want to use:

rm -r .vscode-server