diff options
Diffstat (limited to 'apps/netutils/ftpc/ftpc_rename.c')
-rw-r--r-- | apps/netutils/ftpc/ftpc_rename.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/netutils/ftpc/ftpc_rename.c b/apps/netutils/ftpc/ftpc_rename.c index c1a80c289..d14bdf3f3 100644 --- a/apps/netutils/ftpc/ftpc_rename.c +++ b/apps/netutils/ftpc/ftpc_rename.c @@ -87,6 +87,19 @@ int ftpc_rename(SESSION handle, FAR const char *oldname, FAR const char *newname oldcopy = strdup(oldname); ftpc_stripslash(oldcopy); + + /* A RNFR request asks the server to begin renaming a file. A typical + * server accepts RNFR with: + * + * - "350 Requested file action pending further information" if the file + * exists + * + * Or rejects RNFR with: + * + * - "450 Requested file action not taken" + * - "550 Requested action not taken" + */ + ret = ftpc_cmd(session, "RNFR %s", oldcopy); if (ret != OK) { @@ -96,6 +109,23 @@ int ftpc_rename(SESSION handle, FAR const char *oldname, FAR const char *newname newcopy = strdup(newname); ftpc_stripslash(newcopy); + + /* A RNTO request asks the server to finish renaming a file. RNTO must + * come immediately after RNFR; otherwise the server may reject RNTO with: + * + * - "503 Bad sequence of commands" + * + * A typical server accepts RNTO with: + * + * - "250 Requested file action okay, completed" if the file was renamed + * successfully + * + * Or rejects RMD with: + * + * - "550 Requested action not taken" + * - "553 Requested action not taken" + */ + ret = ftpc_cmd(session, "RNTO %s", newcopy); free(oldcopy); |