Problem solve Get help with specific problems with your technologies, process and projects.

Create a list of all the files in a directory

Use the CFGHTTPSCH CL command to create a list of all the files in a directory.

If you have lots of files in the IFS and need a list of them, or you just want a quick way to find a file without clicking down the directory path, you can use the (Configure HTTP Search) CFGHTTPSCH CL command to create a list of all the files in a directory. Then use an editor to search the list to find the path to one particular file.

It is easy to create the list by using the CFGHTTPSCH command which is meant to be used for setting up a search engine, but it can also be used just to create a list of all the files in a directory or multiple directories. Normally, this list is used to create a search index but it doesn't have to be. Let's say you have a directory called "/mydirectory" which contains 25 or more subdirectories all containing files.

You would enter: 
CFGHTTPSCH OPTION(*CRTDOCL) DOCLIST('/mystuff/mylist.file')    STRDIR('/mydir')            PATTERN('*')   

DOCLIST is the file '/mystuff/mylist.file' that will be created and will contain the path for each file down the directory path (the default is to traverse the directory.) STRDIR is the starting directory and PATTERN can be used to select only files with a particular extension such as *.htm*.

To add another set of files from another directory, there is an OPTION called *UPDDOCL, which updates the document list you have already created. To add files from '/myotherdir' directory, you would enter:

 CFGHTTPSCH OPTION(*UPDDOCL) DOCLIST('/mystuff/mylist.file')    STRDIR('/myotherdir')            PATTERN('*')      
Now the list includes files from both directories.

Note: To use the Webserver search engine, go to the HTTP Server Administration and Configuration forms.


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.