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: 

count the number of files on the FTP server

Former Member
0 Kudos
636

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.

Regards

Jaspreet

1 REPLY 1

Former Member
0 Kudos
81

Hi,

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] 

Parameter(s):
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