Page 1 of 1

FTP - delete all files in a FTP Server directory

Posted: Sun Aug 31, 2014 1:09 pm
by spacewalker
Hello,

I'm looking for some code that deletes all files in a directory on a FTP server.

I already can connect to a FTP server and change to a directory there.

But now I need to delete all files in the current FTP directory.

With DeleteFTPFile() I can delete a single file.. so I guess that I must enumerate all files in the current FTP folder and delete each file?

Thanks

Re: FTP - delete all files in a FTP Server directory

Posted: Sun Aug 31, 2014 1:16 pm
by Shield
spacewalker wrote:With DeleteFTPFile() I can delete a single file.. so I guess that I must enumerate all files in the current FTP folder and delete each file?
Correct. FTP does not support the deletion of non-empty directories, for whatever strange reason.

Re: FTP - delete all files in a FTP Server directory

Posted: Sun Aug 31, 2014 1:47 pm
by IdeasVacuum
You can enumerate the FTP folder in a similar way to a desktop folder:
http://www.purebasic.com/documentation/ ... ctory.html