cURL / Mailing Lists / curl-library / Single Mail


Re: Removing directory from ftp server

From: Dan Fandrich <>
Date: Tue, 12 Oct 2010 12:27:49 -0700

On Sun, Oct 10, 2010 at 09:53:53PM +0530, bhuvanagiri wrote:
> RMD fails to delete the directory if it is not empty. I want to delete the
> directory, its sub-directories and contents inside. How can this be done
> through curl?

I don't believe that recursive delete is specified in RFC959. There may be
a newer RFC that does, but you're probably going to be stuck with finding
a server-specific method if you want to do this efficiently. You could
try something like 'DELE -r dir', or 'DELE dir/*' followed by 'RMD dir'.
Otherwise, you'll have to retrieve a list of files in the directory and
delete them individually, followed by deleting the empty directory
itself. I suspect that's the only portable way to do this.

>>> Dan
List admin:
Received on 2010-10-12