SFXCL COMMAND-LINE TOOL FAQ

SFXCL Command-Line Tool for SecureFX® FAQ (Windows version only)

The SFXCL command-line tool is only available on the Windows version of SecureFX.

More information on using the SFXCL command-line tool can be found in the Help documents included with the SecureFX for Windows application and in the SFXCL Automation Guide.

Is it possible to run SFXCL "stand-alone" from SecureFX?

The SFXCL command-line utility included with SecureFX for Windows is not intended to be used as a stand-alone utility. SFXCL is an automation tool designed to add command-line control of the GUI application. For example, in order to include a named session in a command-line argument, you must first configure and save that named session in the GUI application.

It is possible to configure SFXCL to run in stand-alone mode, but you must first install the entire application and then modify and/or create specific support files. Contact VanDyke Support if you wish to run SFXCL in this fashion.

How can I pass a password in when using URLs as the source and destination for a transfer?

Passwords can be passed in to SFXCL.exe directly.

Download from remote host:

SFXCL sftp://[<user>[:<password>]@]<host address>[:<port>]/<source path> <destination path>

Upload to remote host:

SFXCL <source path> sftp://[<user>[:<password>]@]<host address>[:<port>]/<destination path>

So for instance, the following would be a valid command line:

SFXCL sftp://username:password@someplace.net/pub c:\temp

If the password has to contain the "@" character (for example, when you are logging on as anonymous), you must enter it as the HEX equivalent (%40) or else SFXCL will not accept it:

SFXCL ftp://anonymous:guest%40domain.com@ftp.vandyke.com/pub/crt/ntcrt342.exe c:\temp

I'm trying to perform a transfer using a saved session, pushing a file up to the remote system. I keep getting errors when I try this. What is the proper syntax?

To upload a file to a remote system, use the following syntax:

SFXCL <localpath> /s <sessionname> <remotepath>

To download a file from a remote system, use the following syntax:

SFXCL /s <sessionname> <remotepath> <localpath>

Remember that session names are case sensitive and require path information. For instance, if the session's name is "Work" and it resides in a folder called "My Sessions", you will have to pass "/My Sessions/Work" to /S. Since this particular pathname includes spaces, it will have to be surrounded with quotation marks when passed to the command-line utility.

What degree of wildcard support is available from SFXCL?

Wildcard patterns follow the Windows convention:

  • An asterisk (*) represents 0 to many characters

  • A question mark (?) represents a single character

  • Wildcards may be used in both names and folders

  • When a wildcard is used in the source, the destination must be a folder

Are recursive transfers supported with SFXCL?

Yes, when you specify a folder, it is always recursed for folders and files within it.

What are the return values (%ERRORLEVEL%) for SFXCL?

If a transfer fails, the return code will be non-zero. Success always returns zero (0).

Example:

SFXCL /quicksync C:\MyDocuments MySession /pub/docs download
if not errorlevel 0 goto fail
if errorlevel 0 goto success

I'm trying to use Quick Synchronize to maintain two repositories of files, using the "mirror" option. Can you provide some examples of how to do this?

This is the basic syntax for the QuickSync command:

SFXCL /QuickSync <localpath> <sessionpath> <remotepath> <direction>

For instance, this command line would synchronize the "My Documents" folder with the specified server (session item is named "Work"):

SFXCL /QuickSync "C:\My Documents" "/My Sessions/Work" /usr/username/mdocs mirror

Can I use public-key authentication with SFXCL?

Yes. The identity file can be specified on the command line using the /I option, or you can configure a named session which uses public-key authentication in SecureFX® for Windows. Then, specify this session on the command line as shown in the examples below.

Download from remote host

SFXCL /s <session path> <source path> <destination path>

Upload to remote host

SFXCL <source path> /s <session path> <destination path>

For instance, the following command line would upload all of the files and folders in the "My Documents" folder to the specified server using public-key authentication. This is assuming the session named "SecureWork", which resides in the folder "My Sessions", has been configured to use public key:

SFXCL "C:\My Documents" /s "/My Sessions/SecureWork" /usr/username/mdocs

Note: If the identity file associated with this session requires a passphrase, SFXCL will prompt for it during authentication. If SFXCL must be run in unattended mode, the passphrase can be specified using the /P command-line option, although this is not considered a best security practice.

Can I use the "Scheduled Tasks" function in Windows to automate a file transfer operation by invoking SFXCL.exe?

Yes. Tasks that can be run using SFXCL.exe can be scheduled using the Windows Scheduler.

For specific instructions, see the tip, Setting Up an Automated File Transfer Using SecureFX's SFXCL and Windows Scheduler.

If you are using SecureFX for Windows version 8.0 and newer, you can also use the built-in task scheduler. The task scheduler allows you run transfer and synchronize operations once, or at daily, weekly, or monthly intervals.

Four Fast Ways to Learn More…

  1. Read or download one of our secure solutions white papers.
  2. Download a free 30-day evaluation copy of our products.
  3. Let us help define the right Secure Shell solution for your company.
  4. Subscribe to our What's New page for tips, solution ideas, and product news.