Script execution

From PowerFolder Wiki
Jump to: navigation, search

Contents

Preface

PowerFolder supports to call scripts or executables after successful downloads. This offers great flexibly to embed PowerFolder in workflows or trigger subsequent processing steps after a file has been received. It may or may not pass information about the downloaded file to the script. Each folder can have a different script or executable.

Setup

The script can be entered under "My PowerFolder/Folder/Settings tab/Script after download".

Download script.png

It is possible to choose a file/script with file chooser or directly input a command line. The command line may include placeholders, which get replaced with actual values of the downloaded file on execution.

Please always use absolute paths when specifying a script. It's not defined which execution path is set when starting the script file, even if it's very likely to be the PowerFolder program installation directory. It is not recommended to add hav whitespaces in the path to the script.

Placeholders

$file : The full path and filename of the downloaded file. e.g. "C:\Users\sprajc\PowerFolders\My Files\subdir1\Recent calcualtions.xls".

$path: The full path of the downloaded file. e.g. "C:\Users\sprajc\PowerFolders\My Files\subdir1\".

$folderpath: The path of the folder's base location directory. e.g. "C:\Users\sprajc\PowerFolders\My Files".

$sources: The name of the source computers for the download separated by comma, e.g. ("MyPC,Mac")

Important note: It is recommended to add surrounding quotes since the path/filename may include whitespaces.

Examples

c:\Programs\Notification\notify.exe

Executes "c:\Programs\Notification\notify.exe" after every successful download.

c:\interchange\inbound\receive.bat "$file"

Executes the batch file "receive.bat" and passes the filename with full path information to the script.

cmd /C start "C:\work\auto2.bat" "$file"

Starts the batch file "C:\work\auto2.bat" in a new window and passes the filename with full path information to the script. (Windows only)

cmd /C attrib +h "$file"

Hides the file after download. Sets the hidden file attribute on the target file after download. (Windows only)

cmd /C "$file"

Executes the file after download.

/usr/bin/curl --proxy "" -f -m 20 -s -L
 -F "file=@$file" -F "AutoUpload=true" http://localhost:8080/upload.html

Calls up cURL to upload the recently downloaded file via HTTP to a local webserver.

Setting up without user interface

Scripts can also be launched by installations running without user interface. To do so please edit the configuration file and alter the line

f.XXXXXXXXXXXXXXXXXXX.dlscript=

Append your script / batch execution at the end of this line.

f.d7fa8ccabbdca962f39125057be70707.dlscript=c:\\interchange\\inbound\\receive.bat "$file"

Note: Make sure to use double backslashes on windows systems "\\".

Troubleshooting

PowerFolder logs all successful and failed script executions to the debug logs files. Please check the debug log file for error messages if problems occur.

Related documentation

Personal tools
Navigation