Executing script to lowercase uploaded files

Please post here if you have problems in using Wing FTP Server.

Executing script to lowercase uploaded files

Postby rabidsloth » Wed Jul 27, 2011 5:42 pm

We have WingFTP running on linux, we have a script called lc.sh that lowercases whatever file you call at the end of it, the script looks like this:

Code: Select all
    mv "$1" "`echo "$1" | tr '[A-Z]' '[a-z]'`"

I pointed to the location of the script under the OnFileUploaded on the Execute program tab but I can't seem to get it to trigger properly.

I've tried adding %FileName to the end of the command, or in the parameters section and nothing happens.

Any ideas on how to get this to work? Or any other ideas on getting it to lowercase all files that are uploaded?
posts 7
joined Tue Jun 14, 2011 5:06 pm

Re: Executing script to lowercase uploaded files

Postby FTP » Thu Jul 28, 2011 3:24 am

Why not use a simple Lua script? Just put the following script into "OnFileUploaded -> Lua Script":

Code: Select all
local fullpath = string.gsub("%PathName", "\\","/")
local newpath = string.sub(fullpath,0,string.len(fullpath)-string.find(string.reverse(fullpath),"/"))
os.rename(fullpath, newpath.."/"..string.lower("%FileName"))
Site Admin
posts 1572
joined Tue Sep 29, 2009 6:09 am

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests