Using Shell Scripting

Shell scripting can come handy for doing lots of different tasks. With FTPGetter, you are able to use shell scripting commands to perform certain actions before or after the file transfer. Note that your server account must be allowed to execute shell commands.

Let us take, for example, a task where a large number of files must be downloaded from the server. A brute-force way of performing the job would be creating a task that would walk around all files and folders, downloading files one by one. This is certainly doable in a straightforward way, but will take forever to execute in any environment but a gigabit local network.

Backing Up Remote Folders

If you don't have eternity on your hands, you can make the server create a single compressed archive of all files, download that single file, and unpack it on your local PC. With FTPGetter, this is not only possible, but actually quite easy to do.

Take the following shell command:

tar -cvz --file='/home/sites2/site245/users/vdavidenko/www.tar.gz' /home/sites2/site245/www/

The command will pack the entire content of the /home/sites2/site245/www/ folder except anything stored in folders dl, images, and demo, into a single compressed file /home/sites2/site245/users/vdavidenko/www.tar.gz

The single command will enable you to download a single compressed file instead of possibly thousands of individual files and folders stored in /home/sites2/site245/www/.

Automatic unzip and copy using shell

Let us take another example:

You need to upload a ZIP archive from the server, extract an .exe file from the archive, and then move the ZIP archive into a certain folder. The following commands will do the job:

unzip %remote_file% "*.exe" -d %remote_file_path% mv %remote_file% %remote_file_path%/../

The first line (unzip) will extract the .exe file from the file on the server specified as %remote_file%. The second line (mv) will move the source ZIP archive up one level in the directory structure (the ".." appended to %remote_file_path% means exactly that).

Download files from another server

One more example:

You need to download a file from a remote server to your own remote server, and then download that file to your PC. Execute the following pre-transfer script:

wget -O /home/sites2/site245/www/dl/beta/ftpgetter_pro_setup.exe

The command above will download the file into the folder /home/sites2/site245/www/dl/beta/ located on your own server.

Examples above demonstrate just a few simple things you can do with shell scripting in FTPGetter. Many more complex tasks can be done by using the shell scripts. Comprehensive information about what's available in shell programming is available at