Results 1 to 4 of 4

Thread: Set file permissions using FtpCommand (WinInet.dll)

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    6

    Question Set file permissions using FtpCommand (WinInet.dll)

    I'm trying to use the FtpCommand function in Microsoft's WinInet.dll library to set file and directory permissions on a UNIX FTP server.

    When I run the following command from the MS DOS FTP client, it works and returns the following response:

    ftp> quote site chmod 0700 mydir
    250 Changed.

    When I try to issue the same command via the FtpCommand function, it fails. Here is the response I get back from the FTP server:

    200 Type okay.
    200 PORT command successful.
    500 Syntax error, command unrecognized.

    I am running this command from the root directory.
    The directory I am trying to change perms for is directly under the root directory.
    I have tried specifying the directory using both "/mydir" AND "mydir".
    Have also tried specifying the command string as "quote SITE CHMOD 700 mydir".

    Any help greatly appreciated.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Set file permissions using FtpCommand (WinInet.dll)

    Unix is case sensitive so chmod and CHMOD are different commands. You need it to be lower case.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    6

    Unhappy Re: Set file permissions using FtpCommand (WinInet.dll)

    Yes, I know UNIX is case-sensitive (I saw an example that used the upper-case syntax, so thought I'd try it). Please note that my original command string was specified all lower-case.

    My question is "WHY does 'quote site chmod 0700 mydir' work from the DOS FTP client, but NOT from FtpCommand (same ftp server, etc.)?"

    The following commands all work when executed manually in a DOS FTP session on this FTP server (must specify mode as octal):

    1. quote site chmod 0700 mydir
    2. quote site chmod 0700 /mydir
    3. quote chmod 0700 mydir (this should not work)

    I get the "500 syntax error, command unrecognized" response with the first two commands above, specified as the command string argument to FtpCommand API function.

    I WAS able to find a couple of commands that DO work from FtpCommand:

    1. "rest 5"
    Get "350 Will attempt to restart at position 5"
    (was also able to reset to 0 successfully)

    2. "retr mydir'
    Get the expected error response ("550 No such file." and "500 That is a directory.").

  4. #4
    New Member
    Join Date
    Mar 2005
    Posts
    1

    Re: Set file permissions using FtpCommand (WinInet.dll)

    Try dropping the "quote" portion of the command string.

    Ex:

    strCommand = "site chmod 0700 mydir"

    bRet = FtpCommand(hConnection, False, FTP_TRANSFER_TYPE_UNKNOWN, strCommand, 0, hFile)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width