Looking for help with script to move the file after certain

You can share your Lua Scripts with everybody here.
Post Reply
sebna
Posts: 2
Joined: Tue May 19, 2015 7:31 am

Looking for help with script to move the file after certain

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

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

Post 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%
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

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

Post by FTP »

Already answered your question via email, please check it.
Post Reply