|
-
Mar 14th, 2005, 02:01 AM
#1
Thread Starter
New Member
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.
-
Mar 14th, 2005, 02:06 AM
#2
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.
-
Mar 14th, 2005, 02:38 PM
#3
Thread Starter
New Member
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.").
-
Mar 30th, 2005, 11:24 AM
#4
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|