Tip

Execute remote commands using FTP

Many of you use FTP to transfer files between systems, and FTP is an excellent tool for that purpose. Did you also know that by using FTP, you can enter commands on remote systems? You can do this with the quote command. The quote command lets you send arbitrary commands to the FTP server. By using server sub-commands in conjunction with the quote command, you can execute most AS/400 commands from within your FTP session. Using this approach, you can create files, restore objects, etc. as part of your FTP job stream. The AS/400 sub-command that allows you to do this is rcmd, which allows you to execute remote commands through your FTP server.

Example: quote rcmd CLRPFM FILE(MYLIB/MYFILE) -- Will clear the specified file on the remote system

If you are in an FTP session and want to enter a command on the LOCAL system, you can use the ! command. This works a little differently on the AS/400 and in Windows.

If you enter ! from the a Windows DOS prompt FTP session, you temporarily exit to the DOS prompt until you decide to resume your FTP session. If you enter ! from an AS/400 FTP session, the AS/400 expects you to follow it with an AS/400 command.

Example: ! sndmsg msg(Hello) tousr(tim)

Although not related to the topic at hand, here is another server sub-command I find very useful:

By default, your FTP session will time out after five minutes of inactivity. Using the time command you can increase that amount of time to whatever you choose.

Example: quote time 10000 -- Sets the FTP inactivity timeout to 10,000 seconds


This was first published in March 2001

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.