GNU Emacs Lisp Reference Manual
Most Emacs Lisp file-manipulation functions get errors when used on files that are directories. For example, you cannot delete a directory with delete-file. These special functions exist to create and delete directories.
delete-file does not work for files that are directories; you must use delete-directory for them. If the directory contains any files, delete-directory signals an error.