DEExecuting scripts after download
It's possible to execute a script, after a file has been downloaded by the client. This is useful for post-processing files after download, e.g. moving those files on the disk, passing them to a third party system or notifying someone about the change. It's also possible to pass information to the script for easier handling of the file. Each folder support to execute a script after download.
Configuring script execution after download
To configure the execution of a script after download:
- Enable the Advanced Mode.
- Click on the folder in question in the main window.
- In the right pane which opens up, please click on the Settings tab.
- To add a script, click on the directory icon next to the Execute after download field to select a script from your local disc.
It's possible to pass variables to the script, by appending place holders at the end of the line containing the full path and the script itself. For a full list of place holders, please see the section about it below.
When specifying the script manually (not using the file system browser), please make sure you use an absolute path. Furthermore use quotation marks, when the path or the script itself contains white spaces. - Done. The specified script will now be executed after each download of a remote file.
Passing parameters to the script
As mentioned above, script execution after download supports passing variable to the script. Therefore the client offers some place holders to specify next to the full path and the script name.
Place holder | Description |
---|---|
$file | Contains the full path and the filename of the downloaded file. Example:
|
$path | Contains the full path to the downloaded file. Example:
|
$folderpath | Contains the root path of the folder which contains the downloaded file. Example:
|
$sources | Contains the name of the source devices for this file (comma-separated). Example:
|
Configuration examples
Below you will find some configuration examples for script execution:
To execute C
:\Program Files\Notification\notify.exe
after every successful download:
"C:\Program Files\Notification\notify.exe"
To execute the batch file received.bat
and pass the filename with full path information to the script:
"C:\Scripts\received.bat" "$file"
To start the batch file automation.bat
in a separate window and pass the filename with full path information to the script:
cmd /C start "C:\Scripts\automation.bat" "$file"
To apply the hidden attribute on Windows after the file has been downloaded:
cmd /C attrib +h "$file"
To execute a file after the file has been downloaded:
cmd /C "$file"
To upload a file to a different system using cURL and a web form provided on the remote system:
/usr/bin/curl --proxy "" -f -m 20 -s -L -F "file=@$file" -F "AutoUpload=true" http://upload.example.com:8080/upload.html
Configuring script execution on headless clients
To configure script execution on headless clients, search for the folder name in the Desktop Client Konfigurationsdateien. There will be some entries starting with f.<folder_id>
. Different settings for one folder always start with the same folder ID. Those lines also include a line for the script execution, which has an empty value by default:
f.<folder_id>.dlscript=
To add a script to be executed after downloaded and optionally a place holder for passing a variable to the script, please see the example below:
f.d7fa8ccabbdca962f39125057be70707.dlscript=c:\\Scripts\\received.bat "$file"
Please note: On Windows operating systems it's necessary to use double backslahes in path names.
Troubleshooting script execution
The client logs all successful and failed script executions to the log files, if logging has been enabled. Please check the Desktop Client Logdateien for error messages if you face any problems.