Question: Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm currently using WinSCP on Windows, which is scriptable to some degree but might not be scriptable enough. I'd probably need some kind of cobbled-together solution, so don't be afraid to suggest something with duct tape in it; however, I do need to do the minification on my local computer and upload the squished file, since I use shared hosting and can't install junk on the server.

Thanks.

Answer: 
I just wrote this minfier script in python. Like Bills solution, it uses the YUI compressor, but will work in a make-less environment. It assumes that the raw (unminifie) files will be in /some/path/src/, and that the minified versions should go in /some/path/. It also assumes that the yuicompressor jar file is in the current folder:

```
import os, glob
from subprocess import Popen,PIPE

def RunCommand( cmd, show_output  ):
    p = Popen(cmd, shell=True,stdout=PIPE,stderr=PIPE)
    for line in p.stdout:
        if show_output:
            print line

    outerr = "\n".join(p.stderr.readlines() )   

    if len(outerr) > 0:
        print "ERROR: " + outerr
        sys.exit()

    code = p.wait()         
    if ( code > 0 ):
        print ("ERROR CODE: %i" % code )
        sys.exit()

compresser = "yuicompressor-2.4.2.jar"
dirs = [ "../wwwroot/css/", "../wwwroot/JavaScript/"]

extensions = ["*.js", "*.css" ]

for dir in dirs:
    src = dir + "/src/"
    for ext in extensions:      
        for path in glob.glob( os.path.join( src, ext)):
            file = os.path.basename(path)
            src_file = os.path.normpath( src + "/" +  file )
            dest_file = os.path.normpath( dir + "/" + file )
            if not os.path.isfile(dest_file) or os.path.getmtime(src_file) > os.path.getmtime(dest_file):
                print "minifying %s..." % (dest_file) 
                command = "java -jar %s %s -o %s" % ( compresser, src_file, dest_file )
                RunCommand(command, True)

```
I suggest compressing (by all means in some automated way) on your development machine and testing it there before uploading to your live server. Fundamentally changing your JavaScript as the last stage of your deployment process is an obvious risk for introducing errors.