Skip to content

Instantly share code, notes, and snippets.

@TheBits
Created August 24, 2010 19:09
Show Gist options
  • Save TheBits/548123 to your computer and use it in GitHub Desktop.
Save TheBits/548123 to your computer and use it in GitHub Desktop.
#!/bin/bash
DSTDIR=$1
WPLATESTGZ=$(mktemp)
wget -O $WPLATESTGZ http://wordpress.org/latest.tar.gz
#cp -v latest.tar.gz $WPLATESTGZ
WPLATESTDIR=$(mktemp -d)
tar -C $WPLATESTDIR -xzf $WPLATESTGZ
rm $WPLATESTGZ
WPLATESTDIR="$WPLATESTDIR/wordpress/"
WPLATESTDIRSZ=${#WPLATESTDIR}
for a in `find $WPLATESTDIR`; do
srct=`stat -c %Y $a`
srcd=`stat -c %Y $DSTDIR/${a:WPLATESTDIRSZ}`
if [ $srct -gt $srcd ]; then
echo "update ${a:WPLATESTDIRSZ}"
cp $a $DSTDIR
fi
done
rm -r $WPLATESTDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment