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.

This was first published in June 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.