Skip to Content

FTP_COMMAND directory listing (ls/dir) without details

Hi,

Our SAP system is accessing an FTP server which has some files with very long names on it. When using function module FTP_COMMAND to get the directory listing, using either "ls" or "dir", we get the "ls -l" type listing with permissions, usernames, etc. so the end of the filename is getting cut off. This would appear to be because SAP truncates everything in the return over 100 characters. As a result, I can't use this data to "get" the files, as the filename is incomplete. I can use "mget" to get all the files that match a certain pattern, but the output from "mget" doesn't tell you the names of the files that it's downloaded.

This is a batch program, so we're using the RFC destination SAPFTPA.

Is there a way of getting just the filenames, without the permission/user details, when using FTP_COMMAND. Alternatively, is there any way of getting the filenames returned with an "mget" command? I've been looking at various command options on Windows FTP clients, but SAPFTPA seems to behave quite differently and ignore most of the options. I've tried using "verbose off" - this makes no difference to the output from "ls" and but stops the output from "mget" completely, which is pretty much the opposite of what I was after!

Thanks,

Andrew

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Oct 15, 2015 at 05:08 PM

    You should use 'nlist' command instead of 'ls' command.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 15, 2015 at 10:55 PM

    Your problem is coming from the implementation of the FTP server used by your target machine.

    Function Module FTP_COMMAND is sending your commands, exactly as you type them, to the FTP server. You only have control over the client side of the FTP transaction.The server's response is entirely controlled by its own software.

    It must be possible to set the simplified version of the ls display as the default, but you will need to do it in the remote system.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.