Q&A

  • [급급 질문] FTP에서의 의문점??? [급급 질문]
아래의 소스에서 궁금한게 있는데요..

좀만 봐주세요.... 질문은 소스 밑에 있습니다.....^^;

===================================================================================

procedure TForm1.NMFTP1Success(Trans_Type: TCmdType);

begin

Case Trans_Type of

cmdChangeDir: StatusBar1.SimpleText := 'ChangeDir success';

cmdMakeDir: StatusBar1.SimpleText := 'MakeDir success';

cmdDelete: StatusBar1.SimpleText := 'Delete success';

cmdRemoveDir: StatusBar1.SimpleText := 'RemoveDir success';

cmdList: StatusBar1.SimpleText := 'List success';

cmdRename: StatusBar1.SimpleText := 'Rename success';

cmdUpRestore: StatusBar1.SimpleText := 'UploadRestore success';

cmdDownRestore: StatusBar1.SimpleText := 'DownloadRestore success';

cmdDownload: StatusBar1.SimpleText := 'Download success';

cmdUpload: StatusBar1.SimpleText := 'Upload success';

cmdAppend: StatusBar1.SimpleText := 'UploadAppend success';

cmdReInit: StatusBar1.SimpleText := 'ReInit success';

cmdAllocate: StatusBar1.SimpleText := 'Allocate success';

cmdNList: StatusBar1.SimpleText := 'NList success';

cmdDoCommand: StatusBar1.SimpleText := 'DoCommand success';

end;

end;







procedure TForm1.NMFTP1Connect(Sender: TObject);

begin

StatusBar1.SimpleText := 'Connected';

end;



procedure TForm1.NMFTP1Failure(var Handled: Boolean; Trans_Type: TCmdType);

begin

Case Trans_Type of

cmdChangeDir: StatusBar1.SimpleText := 'ChangeDir failure';

cmdMakeDir: StatusBar1.SimpleText := 'MakeDir failure';

cmdDelete: StatusBar1.SimpleText := 'Delete failure';

cmdRemoveDir: StatusBar1.SimpleText := 'RemoveDir failure';

cmdList: StatusBar1.SimpleText := 'List failure';

cmdRename: StatusBar1.SimpleText := 'Rename failure';

cmdUpRestore: StatusBar1.SimpleText := 'UploadRestore failure';

cmdDownRestore: StatusBar1.SimpleText := 'DownloadRestore failure';

cmdDownload: StatusBar1.SimpleText := 'Download failure';

cmdUpload: StatusBar1.SimpleText := 'Upload failure';

cmdAppend: StatusBar1.SimpleText := 'UploadAppend failure';

cmdReInit: StatusBar1.SimpleText := 'ReInit failure';

cmdAllocate: StatusBar1.SimpleText := 'Allocate failure';

cmdNList: StatusBar1.SimpleText := 'NList failure';

cmdDoCommand: StatusBar1.SimpleText := 'DoCommand failure';

end;

end;



procedure TForm1.NMFTP1Error(Sender: TComponent; Errno: Word;

Errmsg: String);

begin

ShowMessage('Error '+IntToStr(Errno)+': '+Errmsg);

end;



procedure TForm1.FormShow(Sender: TObject);

begin

FTPTimer.Enabled := False;

FTPTimer.Interval:= 1000; //30초 단위

to_date := formatdatetime('yyyymmdd',now);

ftpfile:= to_date + IntToStr(count);

NMFTP1.Host := '203.251.174.14';

NMFTP1.Port := 21;

NMFTP1.Timeout := 360000;

NMFTP1.UserID := 'guest';

NMFTP1.Password := 'guestcare';

try

NMFTP1.Connect;

except

On E:Exception do

if E.message='something'

then writeln('poo');

end;



<*** while FileExists(to_date + IntToStr(count)+'.txt') do <<=== 이부분인데요...

다름이 아니라 여기에 지금 로컬 폴더의 경로가 들어가 있는데..FTP의 서버경로는어찌알아서 넣어야 되나요??

begin

NMFTP1.Download((to_date + IntToStr(count)+'.txt'), ('C:A' + (to_date + IntToStr(count)) + '.txt'));

inc(count); // ".txt"파일 1씩 증가..

end; ***>

FTPTimer.Enabled :=True;

end;

===================================================================================

바로 위에 While 문에서 지금 FileExists함수를 사용했는데요..

그럼 FTP서버의 홈디렉토리 알아 내는 방법은 없나요??? 그래야 While문을 돌려서리 텍스트파일의 유무를 체크하는데요??? 고수님들 좀만 갈켜 주세요???

그리고 다음에는 FTP서버에서 다운 받은 파일을 Delete함수를 사용해서 서버의 홈디렉토리에 있는 차례대로 다운받은 텍스트파일을 지워야 하는데 어디에 넣어야 하는지요??

꼭 멋지고 시원한 답변 부탁드립니다.... 좀 급한거라.

빠른 답변 부탁드립니다....^^;

님들 즐거운 오후 보내세요...

2  COMMENTS
  • Profile
    최용일 2001.10.24 00:37
    안녕하세요. 최용일입니다...



    델파이 Demos폴더에 예제가 있는데 그거 보시면 충분히 하실 수 있습니다.



    TNMFTP.List메소드를 호출하시면 OnListItem이벤트가 발생하면서 폴더에 있는 파일들을



    알려줍니다. TStringList같은데다가 저장해놓고 사용하세요...



    폴더 바꾸는것은 TNMFTP.ChangeDir메소드를 사용하세요...



    가급적이면 급하다는 말은 하지 않으시는것이 좋을겁니다...



    ^^ 항상 즐코하세요..



    델초짜이고 차츰 알아가는 놈... wrote:

    > 아래의 소스에서 궁금한게 있는데요..

    > 좀만 봐주세요.... 질문은 소스 밑에 있습니다.....^^;

    > ===================================================================================

    > procedure TForm1.NMFTP1Success(Trans_Type: TCmdType);

    > begin

    > Case Trans_Type of

    > cmdChangeDir: StatusBar1.SimpleText := 'ChangeDir success';

    > cmdMakeDir: StatusBar1.SimpleText := 'MakeDir success';

    > cmdDelete: StatusBar1.SimpleText := 'Delete success';

    > cmdRemoveDir: StatusBar1.SimpleText := 'RemoveDir success';

    > cmdList: StatusBar1.SimpleText := 'List success';

    > cmdRename: StatusBar1.SimpleText := 'Rename success';

    > cmdUpRestore: StatusBar1.SimpleText := 'UploadRestore success';

    > cmdDownRestore: StatusBar1.SimpleText := 'DownloadRestore success';

    > cmdDownload: StatusBar1.SimpleText := 'Download success';

    > cmdUpload: StatusBar1.SimpleText := 'Upload success';

    > cmdAppend: StatusBar1.SimpleText := 'UploadAppend success';

    > cmdReInit: StatusBar1.SimpleText := 'ReInit success';

    > cmdAllocate: StatusBar1.SimpleText := 'Allocate success';

    > cmdNList: StatusBar1.SimpleText := 'NList success';

    > cmdDoCommand: StatusBar1.SimpleText := 'DoCommand success';

    > end;

    > end;

    >

    >

    >

    > procedure TForm1.NMFTP1Connect(Sender: TObject);

    > begin

    > StatusBar1.SimpleText := 'Connected';

    > end;

    >

    > procedure TForm1.NMFTP1Failure(var Handled: Boolean; Trans_Type: TCmdType);

    > begin

    > Case Trans_Type of

    > cmdChangeDir: StatusBar1.SimpleText := 'ChangeDir failure';

    > cmdMakeDir: StatusBar1.SimpleText := 'MakeDir failure';

    > cmdDelete: StatusBar1.SimpleText := 'Delete failure';

    > cmdRemoveDir: StatusBar1.SimpleText := 'RemoveDir failure';

    > cmdList: StatusBar1.SimpleText := 'List failure';

    > cmdRename: StatusBar1.SimpleText := 'Rename failure';

    > cmdUpRestore: StatusBar1.SimpleText := 'UploadRestore failure';

    > cmdDownRestore: StatusBar1.SimpleText := 'DownloadRestore failure';

    > cmdDownload: StatusBar1.SimpleText := 'Download failure';

    > cmdUpload: StatusBar1.SimpleText := 'Upload failure';

    > cmdAppend: StatusBar1.SimpleText := 'UploadAppend failure';

    > cmdReInit: StatusBar1.SimpleText := 'ReInit failure';

    > cmdAllocate: StatusBar1.SimpleText := 'Allocate failure';

    > cmdNList: StatusBar1.SimpleText := 'NList failure';

    > cmdDoCommand: StatusBar1.SimpleText := 'DoCommand failure';

    > end;

    > end;

    >

    > procedure TForm1.NMFTP1Error(Sender: TComponent; Errno: Word;

    > Errmsg: String);

    > begin

    > ShowMessage('Error '+IntToStr(Errno)+': '+Errmsg);

    > end;

    >

    > procedure TForm1.FormShow(Sender: TObject);

    > begin

    > FTPTimer.Enabled := False;

    > FTPTimer.Interval:= 1000; //30초 단위

    > to_date := formatdatetime('yyyymmdd',now);

    > ftpfile:= to_date + IntToStr(count);

    > NMFTP1.Host := '203.251.174.14';

    > NMFTP1.Port := 21;

    > NMFTP1.Timeout := 360000;

    > NMFTP1.UserID := 'guest';

    > NMFTP1.Password := 'guestcare';

    > try

    > NMFTP1.Connect;

    > except

    > On E:Exception do

    > if E.message='something'

    > then writeln('poo');

    > end;

    >

    > <*** while FileExists(to_date + IntToStr(count)+'.txt') do <<=== 이부분인데요...

    > 다름이 아니라 여기에 지금 로컬 폴더의 경로가 들어가 있는데..FTP의 서버경로는어찌알아서 넣어야 되나요??

    > begin

    > NMFTP1.Download((to_date + IntToStr(count)+'.txt'), ('C:A' + (to_date + IntToStr(count)) + '.txt'));

    > inc(count); // ".txt"파일 1씩 증가..

    > end; ***>

    > FTPTimer.Enabled :=True;

    > end;

    > ===================================================================================

    > 바로 위에 While 문에서 지금 FileExists함수를 사용했는데요..

    > 그럼 FTP서버의 홈디렉토리 알아 내는 방법은 없나요??? 그래야 While문을 돌려서리 텍스트파일의 유무를 체크하는데요??? 고수님들 좀만 갈켜 주세요???

    > 그리고 다음에는 FTP서버에서 다운 받은 파일을 Delete함수를 사용해서 서버의 홈디렉토리에 있는 차례대로 다운받은 텍스트파일을 지워야 하는데 어디에 넣어야 하는지요??

    > 꼭 멋지고 시원한 답변 부탁드립니다.... 좀 급한거라.

    > 빠른 답변 부탁드립니다....^^;

    > 님들 즐거운 오후 보내세요...

  • Profile
    델초짜임다...... 2001.11.02 04:20
    님아 죄송합니다...

    답변 글구 고맙습니다.....

    저번에도 님이 저의 답변 해 주셨죠??? 헤헤헤헤

    감사감사!!!!

    금 수고 하시고요..

    님도 즐코하세요......*^^*;



    최용일 wrote:

    > 안녕하세요. 최용일입니다...

    >

    > 델파이 Demos폴더에 예제가 있는데 그거 보시면 충분히 하실 수 있습니다.

    >

    > TNMFTP.List메소드를 호출하시면 OnListItem이벤트가 발생하면서 폴더에 있는 파일들을

    >

    > 알려줍니다. TStringList같은데다가 저장해놓고 사용하세요...

    >

    > 폴더 바꾸는것은 TNMFTP.ChangeDir메소드를 사용하세요...

    >

    > 가급적이면 급하다는 말은 하지 않으시는것이 좋을겁니다...

    >

    > ^^ 항상 즐코하세요..



    • 바부이니
      2001.10.24 19:20
      델파이를 실행시킬때 뜨는건지 언제 뜨는지 알려주세요. 저두 전에 그런 경험이 몇번있었는데...물론 저는...
    • Tarzan
      2001.10.24 22:16
      감사 합니다. 저는 처음에는 컴파일 시켰을때 뜨더군요.그런후에는 계속 떠요. 그래서 win2000을 깔고 거...
    • 라스트
    • 2001.10.24 02:46
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 2001.10.25 00:40
      저도 이 컴포넌트 많이 사용했는데 전혀 그런 현상이 없는데요... 간단히 테스트 한번 해보세요. u...
    • 강인규
      2001.10.24 07:21
      Data형을 멀로 선언하셨죠? Char로 선언하시면 공백이 따라오는게 정상이구요.. vChar로 선언하시면 ...
    • 궁금이
      2001.10.26 03:22
      답변 감사합니다. 말씀대로 테이블을 새로 만들어서 시험해 봤는데 잘 됩니다. 하지만 기존의 필드타입을...
    • irookie
    • 2001.10.24 01:45
    • 3 COMMENTS
    • /
    • 0 LIKES
    • 화랑
      2001.10.30 05:52
      regsvr32 하셔도 되지만. NT이면 MTS에 올리시고.. 2000이면 COM+에 등록해서 하세요 irookie wrote:...
    • irookie
      2001.10.24 01:59
      델마당에서 답변을 주셨습니다. iis 중지후 다시 시작을 하니 되네요. 그럼, 20000 -------- i...
    • Ziker
      2001.11.07 22:10
      참고하시라고 이렇게 글 하나 더 답니다. iis죽이고 살렸다 죽이고 살렸다하는 방법이 번거럽기때문에 ...
    • 초보
    • 2001.10.24 00:55
    • 3 COMMENTS
    • /
    • 0 LIKES
    • 바부이니
      2001.10.25 20:07
      TQuery콤퍼넌트의 프로퍼티를 보면 이런게 하나 있져? AutoRefresh... 이거 True하세여.
    • 초보의비애
      2001.10.24 02:37
      초보 wrote: > 안녕하세요 아래와 같이 query1.CommitUpdates하게 되면 > DB상에는 입력이 되어 있는데 ...
    • 초보
      2001.10.24 03:10
      해보니까 그래도 안되는데요... 물론 query1.Fieldbyname('Code').asinteger 는 0 이네요... 쩝. DBGrid...
    • 정광호
    • 2001.10.24 00:54
    • 3 COMMENTS
    • /
    • 0 LIKES
    • 최용일
      2001.10.24 03:27
      안녕하세요. 최용일입니다. 뭔가 잘못알고 계신거 같네요... 변수를 선언한다고 해서 절대 그 변수가...
    • 정광호
      2001.10.24 10:05
      최용일 wrote: > 안녕하세요. 최용일입니다. > > 뭔가 잘못알고 계신거 같네요... > > 변수를 선언...
    • 최용일
      2001.10.24 19:49
      전역변수는 0으로 초기화가 되는군요... 원문중에서 a single global variable 란 구문이 좀 의문이 가...
    • 최용일
      2001.10.24 00:37
      안녕하세요. 최용일입니다... 델파이 Demos폴더에 예제가 있는데 그거 보시면 충분히 하실 수 있습니다....
    • 델초짜임다......
      2001.11.02 04:20
      님아 죄송합니다... 답변 글구 고맙습니다..... 저번에도 님이 저의 답변 해 주셨죠??? 헤헤헤헤 감사...
    • P주임
    • 2001.10.23 23:51
    • 0 COMMENTS
    • /
    • 0 LIKES
    • 초보
    • 2001.10.23 23:23
    • 0 COMMENTS
    • /
    • 0 LIKES
    • 초짜
    • 2001.10.23 22:35
    • 0 COMMENTS
    • /
    • 0 LIKES
    • 뻐록이
    • 2001.10.23 21:10
    • 2 COMMENTS
    • /
    • 0 LIKES
    • 최용일
      2001.10.23 21:44
      안녕하세요. 최용일입니다. 아래와 같이 해보세요... Params.TargetFileName := 'C:MSSQL7Binnscm.ex...
    • ^^;
      2001.10.23 22:43
      최용일님 정말 감사합니다 용일님 소스보고 한건데 이것까지도 용일님이 답변을 해 주네요 정말 감사...
    • 김남주
    • 2001.10.23 20:50
    • 1 COMMENTS
    • /
    • 0 LIKES
    • aparadin
      2001.10.23 21:06
      김남주 wrote: > 내폼안에 외부프로그램을(예를 들어서 제가 만든 메모장 프로그램) 같은 프로그램을 > ...
    • 나그네
    • 2001.10.23 20:09
    • 4 COMMENTS
    • /
    • 0 LIKES
    • 조규춘
      2001.10.23 21:40
      나그네 wrote: > 델파이로 I.E 에 제가 원하는 band를 추가하고 그 위에 toolbutton을 생성하고 싶은데 ...
    • 최용일
      2001.10.23 21:49
      규춘님 반가워요.. 정말 오래간만이네요... 잘 지내고 있는지... 정미님도 잘 지내시죠? 조규춘 w...
    • 조규춘
      2001.10.23 21:54
      최용일 wrote: > 규춘님 반가워요.. > > 정말 오래간만이네요... 잘 지내고 있는지... > > 정미님도...
    • 최용일
      2001.10.23 21:56
      헉~ 진짜 정곡을 찔렸네요... ㅠ'ㅠ... 조만간 하게 되겠죠... 행복하다니...넘 부럽네요... 조규...
    • 김대희
    • 2001.10.23 19:24
    • 2 COMMENTS
    • /
    • 0 LIKES
    • P주임
      2001.10.23 23:56
      앞에 코딩을 안하더라도 스프리드 그리드 프로그램에서요 그 옵션을 잘 확인해보세요 Genenal 제너럴 옵...
    • 조규춘
      2001.10.23 21:43
      김대희 wrote: > 델파이 유지보수작업 하는 초보입니다. > 스트링그리드 2 칼럼에 하나의 칼럼을 추가해...
    • ^^
    • 2001.10.23 19:09
    • 1 COMMENTS
    • /
    • 0 LIKES
    • ^^
      2001.10.24 01:38
      ^^ wrote: > win 2000, 델파이 5.0 > > 어떤 기능을 수행하면 자동으로 프로그램을 재시작하려고 합니...