SSH2 Remote Copy” in Token2Shell uses the existing SSH connection, i.e., it opens an additional independent channel over the existing connection and communicates with server about file and folder information. Thus you do not need to enter login information again and again just to upload or download files. When you need to upload files, just drag-and-drop them on Token2Shell; to download, just click the download toolbar button and select files!

You can further simplify the file transfer process by adjusting your server login scripts and have Token2Shell automatically detect your current working directory path on the server.

When it’s set up properly, file uploading just becomes drag-and-drop and clicking <OK>; for file downloading, you just need to select files from a popup window that lists files in the server directory where you were working on. You no longer need to navigate back and forth to find a source or destination directory on your server.

You can synchronize the directory path in two ways:

1. Use XTerm terminal control code for setting window title.

If you set the window title with path information as the last item, Token2Shell should be able to automatically extract the path information from that title.

2. Use Token2Shell proprietary control code sequences.

<ESC>]5001;{remote path}<BEL>

Set {remote path} as the initial path for file transfer.


<ESC>]5002;{remote path}<BEL>

Invoke file uploading from Token2Shell.
{remote path} is used for initial path.


<ESC>]5003;{file list}<BEL>

Invoke file downloading from Token2Shell.
{file list} is the list of file names for downloading.

Each item in {file list} must be wrapped with quotation marks(“) and separated by a space.

<ESC>]5003;”” “”<BEL>

Please note that <ESC> and <BEL> shown above denote actual ESC control character (\033, 0x1B) and BEL control character (\007, 0x07) respectively.

Example: tcsh

Please note that ‘^[‘ and ‘^G’ in these examples are control characters, <ESC> and <BEL> respectively. Control characters can be entered in tcsh command prompt by pressing <CTRL> + V and then the actual control character. For example, if you wish to enter <ESC> control character, press <CTRL> + V and then hit <ESC> key.

  1. Setting an alias for notifying Token2Shell when the current working directory is changed.
    tcsh has a function ‘cwdcmd()‘ that is executed whenever the directory is changed. It can be aliased to automatically notify Token2Shell when such command as ‘cd‘ is used.
    alias cwdcmd 'echo -n "^[]5001;${cwd}^G"'
  2. A download invoking script that sets the current working directory as the source path and automatically wraps the arguments with quotation marks.
    echo -n '^[]5001;'
    echo -n "$PWD"
    echo -n '^G'
    echo -n '^[]5003;'
    while [ $# -ge 1 ]; do
            echo -n '"'"$1"'" '
    echo -n '^G'
    Assuming that you have created an executable file with the above script and named it “t2sf“, you can invoke Token2Shell download by typing:

    This command will invoke Token2Shell download and add “” and “” to the download file list edit box. You then just need to press the “Download” button to start the file transfer.

Example: bash

bash has an environment variable called ‘PROMPT_COMMAND‘ and this variable is executed just before bash displays a prompt. Hence, setting the variable as below should allow Token2Shell to properly adjust its copy of the path info. (For configuring the variable, you should edit “.bash_profile” under your $HOME directory.)

PROMPT_COMMAND='echo -ne "\033]5001;"; if [ ${PWD:0:${#HOME}} == ${HOME} ] && ([ ${#PWD} == ${#HOME} ] || [ ${PWD:(${#HOME}):1} == "/" ]); then echo -ne ".${PWD:${#HOME}}"; else echo -ne "${PWD}"; fi; echo -ne "\007";'; export PROMPT_COMMAND

Please note that the above example removes the beginning portion of the path if it matches your $HOME directory path and replaces it with “.”. For example, if your $HOME path is “/home/user1” and the current path is “/home/user1/pub”, the script returns “./pub“. This behavior should be preferable if your SFTP configuration doesn’t allow accessing outside of your $HOME directory or using full absolute path.