Reputation: 4102
The question is: can PHP ftp_delete()
remove a folder?
I have a process that uses ftp_delete()
for removing ftp files but I fear I might accidentally remove a folder if the filename is empty.
Upvotes: 0
Views: 297
Reputation: 6021
No, it cannot. You need to use ftp_rmdir
to delete folders.
http://php.net/manual/en/function.ftp-rmdir.php
Note:
The directory to delete. This must be either an absolute or relative path to an empty directory.
Upvotes: 1
Reputation: 74217
From the manual:
"ftp_delete() deletes the file specified by path from the FTP server."
It doesn't delete a folder, rmdir()
does.
"rmdir — Removes directory"
Note:
Attempts to remove the directory named by dirname. The directory must be empty, and the relevant permissions must permit this. A E_WARNING level error will be generated on failure.
Upvotes: 4
Reputation: 413
1.-You need to check the docs, the answer is there.
2.- http://php.net/manual/en/function.ftp-delete.php According to the docs, no. It says "files" not "files or folders", I think the final answer is no.
Upvotes: 1