Ask the Expert

Listing contents of multiple FTP directories on AS/400

During an FTP session, I need to go to three directories on a remote system. I want to list out the contents of the directories for me to use later.

I know I can use the DIR (disk command, and it will put the data in *CURLIB/DIROUTPUT.DIROUTPUT, but it is a replacement, not an add, so I can only get one directory listing per FTP session.

I don't want to have to end the session, and restart it three times. Any suggestions? Am I missing something?

Using the DIR command, you would be using something like,

DIR direct1/*.* > DIROUTPUT.DIROUTPUT

The > symbol redirects the output to the file specified. This will, as you say, replace any data in the file. So, use this for the FIRST directory listing in your session, then for the OTHER two, use :

DIR direct2/*.* >> DIROUTPUT.DIROUTPUT
DIR direct3/*.* >> DIROUTPUT.DIROUTPUT

Using the > symbol twice means 'append the data to the file'.

This was first published in May 2008

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: