Please post here if you have problems in using Wing FTP Server.
-
rabidsloth
- Posts: 7
- Joined: Tue Jun 14, 2011 5:06 pm
Post
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?
-
FTP
- Site Admin
- Posts: 2082
- Joined: Tue Sep 29, 2009 6:09 am
Post
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"))