Looking for help with script to move the file after certain

You can share your Lua Scripts with everybody here.

Looking for help with script to move the file after certain

Postby sebna » Tue May 19, 2015 7:35 am

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
sebna
 
2
 
Tue May 19, 2015 7:31 am

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

Postby sebna » Tue May 19, 2015 9:46 am

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%
sebna
 
2
 
Tue May 19, 2015 7:31 am

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

Postby FTP » Wed May 20, 2015 2:42 am

Already answered your question via email, please check it.
FTP
Site Admin
 
1876
 
Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests