Page 1 of 1

Executing script to lowercase uploaded files

Posted: Wed Jul 27, 2011 5:42 pm
by rabidsloth
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

    #!/bin/sh
    
    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?

Re: Executing script to lowercase uploaded files

Posted: Thu Jul 28, 2011 3:24 am
by FTP
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"))