Unix – Directory not empty. Error -126: remote rmdir failed

ftpunix

I have the following directories on the root of my server

  • htdocs
    • [site contents]
  • mike-eng
    • stage
  • old2
  • stats

I am trying to delete the "mike-eng" directory here.

Permissions on "mike-eng" and "stage" are 777. Neither directory is showing any files in my FTP client (Transmit), which shows hidden files in other directories. Also, the command line shows the directories as empty:

ftp> cd mike-eng

250 CWD command successful

ftp> ls

229 Entering Extended Passive Mode (|||29910|)

150 Opening ASCII mode data connection for file list

drwxrwxrwx 2 1191966 15000 4096 Jan 11 15:55 stage

226 Transfer complete

ftp> cd stage

250 CWD command successful

ftp> ls

229 Entering Extended Passive Mode (|||48904|)

150 Opening ASCII mode data connection for file list

226 Transfer complete

When I try to delete the "mike-eng" directory using Transmit, I get the following error:

stage: Directory not empty

Error -126: remote rmdir failed

When I connect using Terminal and try to delete the "mike-eng" directory from the command line, I get:

ftp> rm mike-eng

550 mike-eng: Directory not empty

If I navigate inside the "mike-eng" directory and try to delete the "stage" directory, I get:

ftp> rm stage

550 stage: Directory not empty

How can I delete this directory and its sub-directory?

Best Answer

There's probably a hidden file in mike-eng. Try

ftp> cd mike-eng
ftp> mdelete .*
ftp> cd ..
ftp> rmdir mike-eng
Related Question