login about faq

Why do I get this error? Here is my code snippet:

    success = ftp.CreateRemoteDir("/test/update");
    DllDate: Jun 23 2016
    UnlockPrefix: anything
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 11.0 (32-bit)
    VerboseLogging: 1
    dir: /test/update
            sendingCommand: MKD /test/update
            replyLineQP: 550 Create directory operation failed.
            commandResponse: 550 Create directory operation failed.
            statusCode: 550
        Simple path command failed.
        statusCode: 550
        reply: 550 Create directory operation failed.

asked Jul 01 '16 at 08:11

chilkat's gravatar image

chilkat ♦♦

edited Jul 01 '16 at 08:14

There are several reasons why the above code failed.

  1. The remote directory already exists.
  2. An FTP account is usually restricted to it's HOME directory and below. It's generally not permissible (due to server-side permissions) to create files or directories anywhere on the remote filesystem.
  3. Given that an FTP account is restricted to the HOME directory and below, it never really makes sense to pass an absolute directory path to CreateRemoteDir (or any method that accepts are remote path). Relative directory paths should be used. (An absolute directory path begins with "/", whereas a relative path does not.)
  4. It is not a good idea to assume that the FTP server will automatically parse the directory path and either (a) create any subdirectories required or (b) create the final directory in the path. A more durable and failsafe solution that will work with any FTP server is this:
    // First try changing the remote directory to "test"
    success = true;
    if (!ftp.ChangeRemoteDir("test"))
    success = ftp.CreateRemoteDir("test");
    if (success) success = ftp.ChangeRemoteDir("test");
    if (!success)
        return false;
    // Now create the directory "update" (which will be located within the "test" 
    // subdirectory because we've changed the current remote directory to "test")
    success = ftp.CreateRemoteDir("update");
    if (!success)
    return false;

answered Jul 01 '16 at 08:37

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jul 01 '16 at 08:11

Seen: 4,328 times

Last updated: Jul 01 '16 at 08:37

powered by OSQA