Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Ftp file list

Former Member
0 Kudos

hallo everybody,

I need to read a directory on an ftp server to know which files are stored...

Could you help me?

Thank you very much!

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check test program RSFTP002

Regards,

Rich Heilman

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check test program RSFTP002

Regards,

Rich Heilman

0 Kudos

thanks for your answer, but is there a function that gives an internal table with file list?

0 Kudos

If you take a look at the program mentioned above, you will see this coding.



if cmd1 ne ' '.
  call function 'FTP_COMMAND'
    exporting
      handle        = hdl
      command       = cmd1
      compress      = compress
    tables
      data          = result
    exceptions
      command_error = 1
      tcpip_error   = 2.
  loop at result.
    write at / result-line.
  endloop.
  refresh result.
endif.

The RESULT internal table will have the list of documents, all you need to do is enter the correct command on the selection screen.

So for example, if your ftp destination url looks like this......


ftp://100.200.123.456/documents/

then enter the following on the selection screen of the test program.


Host                              100.200.123.456
Command 1                    dir documents

Run this program and you will see the list of files under this directory.

Regards,

Rich Heilman

Edited by: Rich Heilman on Jan 2, 2008 11:56 AM

0 Kudos

Thank you very much.

I had seen how the function works, anyway the table has no structure, no it is not very east to get the name of the files stored in the table itsself.

0 Kudos

That's right the table has no structure, which means that you will need to parse out the file names, using fixed length offsets and so on.

Regards,

Rich Heilman

0 Kudos

Thanks guys,

your help is always precious.

Former Member
0 Kudos

Check this function module...

RZL_READ_DIR_LOCAL

0 Kudos

Thanks,

bu FM RZL_READ_DIR_LOCAL seems to be useful just for local directory, while I need to read an ftp directory.