Page 1 of 1

Looking for help with script to move the file after certain

Posted: Tue May 19, 2015 7:35 am
by sebna
Hi,

I am looking to create a script that will allow me to limit the number of downloads per file to set number for example 2 per file. After reaching the limit file would be automatically moved or deleted so user cannot download it anymore.

Could anyone offer any advice? I am completely new to LUA scripting so any and all help will be very welcomed as I do not even know where to start yet. I am starting to read about LUA but I thought I will ask a question in the mean time so if there is any good soul willing to help he / she has a chance to do so :)

Thanks

Re: Looking for help with script to move the file after cert

Posted: Tue May 19, 2015 9:46 am
by sebna
I am running my WingFTP on Windows platform so natural for me was to try to achieve what I am looking for with simple batch job.

I created this simple test batch job which is creating a folder for logged in username and then moves and renames last accessed file to previously created folder.

The script works once run from command line but does not work correctly when run from WingFTP (via OnFileDownloaded HTTP trigger) using %PathName %FileName %Name as parameters (in parameters section of "Execute program" tab).

It does not pass parameters correctly.

Code: Select all

:: 1% - %PathName	- The last accessed file's path
:: 2% - %FileName 	- The last accessed file's name, like "test.zip"
:: 3% - %Name 		- The session's User Nam

set arg1=%1
set arg2=%2
set arg3=%3

mkdir e:\test\%arg3%

::move %arg1%%arg2% e:\test\%arg3%\%arg2%_%arg3%

Re: Looking for help with script to move the file after cert

Posted: Wed May 20, 2015 2:42 am
by FTP
Already answered your question via email, please check it.