[prev in list] [next in list] [prev in thread] [next in thread] 

List:       twsocket
Subject:    Re: [twsocket] Strange bug in TFtpServer
From:       "Fastream Technologies" <fastream () fastream ! com>
Date:       2003-11-26 11:41:05
[Download RAW message or body]

Hello,

Unfortunately this did not work either:

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*}
procedure TFtpServer.CommandMDTM(
    Client      : TFtpCtrlSocket;
    var Keyword : TFtpString;
    var Params  : TFtpString;
    var Answer  : TFtpString);
var
    FileTime : String;
    FileName : String;
begin
    Client.CurCmdType := ftpcMDTM;
    FileName          := BuildFilePath(Client, Client.Directory , Params);
    if Params = '' then
        Answer := msgMdtmSyntax
    else if not (FileExists(FileName) or DirectoryExists(FileName)) then
        Answer := Format(msgMdtmNotExists, [FileName])
    else begin
        try
            if (FileName[Length(FileName)] = '\') and
DirectoryExists(FileName) then
                FileName := Copy(FileName, 1, Length(FileName) - 1);

            FileTime := FileUtcStr(FileName);
            if Length(FileTime) <> 0 then
                Answer := Format(msgMdtmOk, [FileTime])
            else
                Answer := Format(msgMdtmFailed,
                                 ['UTC File time retrieval failed'])
        except
            on E:Exception do
              Answer := Format(msgSizeFailed , [E.Message]);
        end;
    end;
end;

where,

function GetFileAge(cFile : String) : Integer;
begin
    if cFile[Length(cFile)] in ['\', '/'] then
        cFile := cFile + '.';
    Result := FileAge(cFile);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*}
function FileUtcStr(cFileName : String) : String;
begin
    Result := TimeDateStr(
                  DateTimeToUTC(
                      FileDateToDateTime(GetFileAge(cFileName))));
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*}

The error given is:

ftp> literal mdtm winzip
550 Command failed: Invalid argument to date encode.

where winzip is a directory name.

Any other suggestions?

Regards,

SZ

----- Original Message ----- 
From: "Bruce Christensen" <twsocket@shaw.ca>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Wednesday, November 26, 2003 11:30 AM
Subject: Re: [twsocket] Strange bug in TFtpServer


> Hi -
>
>   Normally when specifying a sub-dir (folder) for
> manipulation you should not have the trailing path
> delimiter attached: (eg)
>
>          c:\test\bruce\
>
>      - should be:
>
>          c:\test\bruce
>
> Note:  I haven't tried this situation with FileAge yet,
>        but the logic seems sound?
>
> Bruce
>
> Hi Fastream, you wrote on 2003/11/26 00:47:53:
>
> >            if (FileName[Length(FileName)] <> '\') and
> >DirectoryExists(FileName) then // added by SZ
> >                FileName := FileName + '\'; // added by SZ
>
>
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic