Archive

Posts Tagged ‘bash’

Simple way to disable direcotry index in webserver

March 14th, 2009

This script will disable webserver’s directory index for currect directory and all subdirectories.

IFS=$'\n'
for i in $( find . -type d); do
    if [[ ! -f "$i/index.html" && ! -f "$i/index.php" ]]; then
        touch "$i/index.html"
    fi
done
Bookmark and Share  
 

Yejun Linux, Web , ,

One line script to minify js css directory using yuicompressor

February 11th, 2009

The default installation of WordPress use full version of css and javascript library. In order to minify all of these files, I wrote this bash script to minify all of them. There will be no progress bar while minifying, so be patient.

cd wordpress
find -H . -type f -writable  \( -name \*.css -o -name \*.js \)  \
-exec sh -c "yuicompressor {} -o /tmp/yui.tmp && mv /tmp/yui.tmp {}" \;

This will only work under POSIX system.
Findutils should be included in most popular Linux distros.
Yuicompressor can be downloaded from here.

Bookmark and Share  
 

Yejun Linux , , , , , , , ,