#!/bin/bash
# simple script to create dated dirs
# run this script as root. change paths if you're not using standard.
date=`date +%y-%m`
#date2=`date --date '1 month ago' +%y-%m` # this is just an example
# the following will make sure people can't upload to old dated dirs
chmod o-w /glftpd/site/0day/*
chmod o-w /glftpd/site/mvids/*
chmod o-w /glftpd/site/mp3/*
# this will create a new dated dir
mkdir /glftpd/site/0day/$date
mkdir /glftpd/site/mvids/$date
mkdir /glftpd/site/mp3/$date
chmod 777 /glftpd/site/0day/$date
chmod 777 /glftpd/site/mvids/$date
chmod 777 /glftpd/site/mp3/$date
# This will create a 'today' link to today's dated directory
cd /glftpd/site
rm _0day_last
rm _mp3_last
rm _mvids_last
ln -s ./0day/$date _0day_last
ln -s ./mp3/$date _mp3_last
ln -s ./mvids/$date _mvids_last