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.
Showing results for 
Search instead for 
Did you mean: 

count the number of files on the FTP server

Former Member
0 Kudos

Hi All,

I have a requirement for which I have a few files on the FTP server and i need to count the number of files and upload them into Sap. How can I do that? Please help.

Thanks in Advance.




Former Member
0 Kudos


You can use LS command of FTP

lsDisplays an abbreviated list of a remote directory's files and subdirectories. 
Syntax: ls [remote-directory] [local-file] 

remote-directory - Specifies the directory for which you want to see a listing. If no directory is specified, the current working directory on the remote computer is used. 
local-file - Specifies a local file to store the listing. If not specified, output is displayed on the screen.

You can download list in the local file and then read that file content into internal table and can easily count the number of files.

You can specify the directory where your files are saved or save your required files in one dirctory of the FTP