FTP - delete all files in a FTP Server directory

Just starting out? Need help? Post your questions and find answers here.
spacewalker
User
User
Posts: 19
Joined: Tue Apr 27, 2010 4:35 pm
Location: Germany

FTP - delete all files in a FTP Server directory

Post 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
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

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

Post 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.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

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

Post by IdeasVacuum »

You can enumerate the FTP folder in a similar way to a desktop folder:
http://www.purebasic.com/documentation/ ... ctory.html
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply