Skip to main content

Using FTP and SFTP in AnzioWin

With AnzioWin version 15.0, we have included an enhanced interactive FTP dialog that operates similar to Windows Explorer. The FTP dialog, shown below, allows you to select a file on either the PC or the host and move it to the other.

This dialog is accessed under the "Transfer : FTP." menu item or under the "File : FTP (different host)." menu item.

"Transfer : FTP." Menu Item 

This menu item uses the current host you are logged into to establish an FTP connection to. If you are using the Login Wizard with a Username and Password (under the Communicate menu), then AnzioWin will attempt to automatically start the FTP session and log in using that information.If you are not using the Login Wizard, then AnzioWin will bring up the following dialog asking for Login and Password to log in as. 

"Transfer : FTP (different host)." Menu Item

This menu item also starts the FTP dialog. However it first brings up the following login dialog, requesting the host, port (default is port 21), user name, user password and the initial directory to start in on the host (leave blank to select the users home directory after logging in).Also on this dialog, you can select if your initial connection should be a passive connection (reference the FTP protocol documentation found in several locations on the web before checking this option).

 

The Dialog

Once a connection is made to the FTP server, AnzioWin displays the following dialog, listing your local PC files in the left side list box and your current logged into host directory and files in the right side list box. AnzioWin does not build a complete directory list of the host on startup, but rather only files and directories found in the initial startup location.

The current working directory on the PC is always listed in the second box from the top on the left, while the current working directory on the host is always listed in the top box on the right. If a file is selected on the PC, it will appear in the top left 0box, while if a host file is selected, it will appear in the second box on the top right.

When the "Binary" box is checked, any file transfer is done as is, as binary raw data.

If the box is unchecked, the file is moved as an ASCII file whereby carriage return and line feeds are converted according to the direction you transfer.In the local PC box (the left side), no files marked with the "hidden" attribute turned on will be displayed unless the "Include hidden PC files" box is checked.In the host box (the right side), no files beginning with a '.' (dot or period) are shown unless the "Include hidden host files" box is checked.

Transferring a file will be discussed below in more detail, but in brief

 

  • To transfer a file from the PC to the host, you would select a file in the PC list box with your mouse and the click the double arrow button pointing toward the host directory on the first line)
  • To transfer a file from the host to the PC, you would select a file in the host list box and click the double arrow button pointing toward the PC selected directory (the second line)

This dialog is also resizeable. By dragging the bottom left corner or edge, you can expand the dialog size and view more of the tree structure.

When you are done with this dialog, you click on the "Done" button to disconnect your FTP session from the FTP server.

The Popup Menus

When you are over the top of either the local PC list box or the host list box and right click with the mouse, a popup menu comes up. The following menu items are possible, depending on whether you click on a file or a directory,

Some of these items may or may not be visible, some may be grayed out, depending on whether you click on a file or directory and whether the file extension for the file you selected is "known" to AnzioWin (see notes below on "FTP Configure Options".

Methods of Transferring a File

A file transfer consists of the movement of a file over the network connection from a specific directory for a specific file, to a directory on the other end. A "put" moves the file from the PC to the host, while a "get" does a transfer from the host to the PC.

There are four methods of starting a file transfer. All three do exactly the same thing, just slightly different approaches to initiating them.

From Dialog with <<  or  >>

By selecting a file on either the PC or the host, you can easily move a file by next clicking on the correct double arrow button. Transfers of the file name shown are done to the directories shown on the appropriate sides of the arrow buttons.

From Popup Menu Item

By right clicking on a file item in one list box, you can then do a send to the other list box, causing a get or put to take place.

By Drag/Drop Mouse Action

You can left click and hold down the mouse button while you drag a file name from one box to the other. When you release the mouse button over the other box, the file is transferred. If you release over a directory name, the file is transferred into that directory, whereas if you release over a file name, the file is transferred into the parent directory for that file name.

Via commands in scripts or macros

There are several commands (see the section below on Commands) that allow you to perform the general functions of "getting" or "putting" a file.

Popup Menu Actions

Menu items on the popup menus for the PC and host list boxes allow various actions to take place, depending on a) whether you right click on a file or directory, b) whether the file has an extension, and c) whether the file extension is valid in the FTP Configure Options.

Send To <..>

This option, when available will allow you to start a transfer of a file similar to clicking on the double arrows.

Open

Windows associates a specific file extension with a program to run. Opening a file with an extension will cause the application which handles the extension to open, such as for ".doc" files, Microsoft Word will be brought up if it is installed. 

When you click on a file, AnzioWin first looks in the FTP Configure Options settings (see below) to see if that extension is valid for Open. If not, then this item is not visible in the popup for that file.

If you right click on a file in the host list box, and the extension is one that can be opened, the file is first transferred to the PC and then the file name is passed to Windows to open the associated application for the file extension.

Print

Like the Open above, Windows associates a specific file extension with a program to print by.  Printing a file with an extension will cause the application which handles the extension to print it, such as for ".doc" files, Microsoft Word will be brought up if it is installed and print the file for you.When you click on a file, AnzioWin first looks in the FTP Configure Options settings (see below) to see if that extension is valid for Print. If not, then this item is not visible in the popup for that file.

If you right click on a file in the host list box, and the extension is one that can be printed, the file is first transferred to the PC as a temporary file and then passed to Windows to print the file with the appropriate application for the selected file extension.

Print with Print Wizard

When "Print with Print Wizard and a file is selected, either in the host or the PC list boxes, the file is passed off to Print Wizard and printed using the current settings and features of Print Wizard and AnzioWin.

Print with Preview

When "Print with Preview" and a file is selected, either in the host or the PC list boxes, the file is passed off to Print Wizard with the "preview" option selected, and previewed using the current settings and features of Print Wizard and AnzioWin.

New Directory

When selected from the popup menu, a new directory is created on the PC or the host.

Change Directory

Select this item to change the current working directory for either the host or the PC.

Remove Directory

Select this item to remove the currently selected directory. You must of course have permissions to do so.

Rename Directory

Select this item to rename the currently selected directory.

Rename File

Select this item to rename a file either on the host or the PC.

Delete File

Select this item to delete a file from the host or PC. 

FTP Configure Options

Under the Transfer : Transfer Options menu item you can access the FTP Options. These include options to control the behavior of the FTP Dialog.

The FTP Configure Options, shown below, include the following items.

Host directory to start in

When a user logs in, this is the default directory to start in.

Passive

When checked, an FTP transfer is done in "passive" mode.

Binary

When checked, a file transfer is done in "binary" mode.

Disable popup menu

When checked, the popup menu for the local PC and the host list boxes do not appear.

Disable opening a file

When checked, the popup menu item for "open" and "print" are not available.

File extensions 'open' is allowed to open

This is a list of file extensions that are allowed to be opened. If the host file or the PC file extension is NOT in this list, the "open" menu item does not appear. Each file extension is separated by a '|'.

SFTP - Secure Shell File Transfer

 Secure Shell FTP behaves exactly like the regular FTP dialog except that the SSH login and password authentication takes place and all session activity is encrypted.

One item worth noting, the SFTP protocol works over a backchannel connection to the SSH daemon (SSHD) on the file server. This means SFTP connections take place over the same open ports as SSH connections do, no special port needs to then be open in your router or firewall.

Commands

AnzioWin supports scripting and script commands, as well as simple user-defined macro. From within AnzioWin, you can set a macro or script to run as an association to special key or key sequence, to initiate a file transfer over the FTP or SFTP protocol. New commands in AnzioWin to support FTP file transfers are

FTPPUT, FTPPUT/S, FTPGET, FTPGET/S

New commands in AnzioWin to support SFTP file transfers are

SFTPPUT, SFTPPUT/S, SFTPGET, SFTPGET/S

These require WININET.DLL, which comes with Internet Explorer and some versions of Windows. They allow AnzioWin to work as an FTP client, although commands can be issued from the host (through Anzio's usual command protocol). Commands assume that the host name, username, and password for the FTP session are the same as for the Anzio telnet connection. Thus the command can be as simple as

FTPGET

The full syntax is:

FTPGET[/S] [ASCII] []

where can be a name, a path name (with either kind of slash), or a URL matching:

username[:password]@hostname[:port]/filepath

(note that you can't do username and filepath but not hostname). The "ASCII" modifier causes an ASCII (text mode) transfer. If is not given, the PC file name will be derived from the base name (name without directories) of the hostname. The "/S" causes a status result to be sent to the host ("00" means success). FTPPUT follows the same syntax. Environment variable expansion will take place. Anzio's DOWNLOAD DIRECTORY will affect downloads (FTPGET[/S]). There may be a delay, with no progress indicator, during long transfers.

FTPGET/S [ASCII] hostfile [pcfile]
FTPPUT [ASCII] hostfile [pcfile]
FTPPUT/S [ASCII] hostfile [pcfile]

where hostfile name is not optional, but pcfile is. Binary is the default transfer type, but you can override this with "ASCII". As an example, suppose you want to move a file named "myfile" from your own home directory on the host to your PC. Just do (after an f):

FTPGET myfile

These commands assume that you are dealing with the same host, the same user login, and the same password that Anzio is already accessing. Be sure you have the username and password entered in Anzio's Communicate:Login menu. You can use any of the following variations:

FTPGET ASCII myfile
FTPGET myfile pcfilename
FTPGET hostname/myfile

can be a name, a path name (with either kind of slash), or a URL matching:

username[:password]@hostname[:port]/hostfileandpath

(note that you can't do username and file path but not hostname). The "ASCII" modifier causes an ASCII (text mode) transfer.

If is not given, the PC file name will be derived from the base name (name without directories) of the hostname. Anzio's DOWNLOAD DIRECTORY will affect downloads (FTPGET[/S]). FTPPUT uses the same syntax as FTPGET:

FTPPUT[/S] [ASCII] []

One more example, a shell command telling Anzio to do a transfer:

printf "\034ftpput/s uploaddir/newfile c:/transfer/upfile\035";

(note that using forward slashes simplify the shell scripting).

Copyright © 2024 Rasmussen Software, Inc. Legal Information & Privacy Policy
Send comments and suggestions to rsi@anzio.com