Hello there,
When I'd created the: Statistics from youtube_cache.log by day (http://cachevideos.com/forum/post/statistics-youtubecachelog-day), I put a routine to alter the date of modified of file when it is request on day. With this is possible to delete the files that no have access for a long time.
For execute this, use: ./script.sh A B
where:
A = File's data was last modified A*24 hours ago.
B = Use Y to delete without ask you.
#!/bin/sh # lopan dot eti at gmail dot com (Author: Lopan) # GPL2 #Variables VIDEO_CACHE_DIR=/var/spool/squid/video_cache DAYS=$1 DL=$2 #Select file's data was last modified $DAYS ago for MB in $(find $VIDEO_CACHE_DIR -mtime +$DAYS -exec ls -l {} ';' | awk '{print $5}'); do MBT=$((MBT+MB)) done #Print total in GB of selected files echo "You are selected *`echo $MBT/1024/1024 | bc`GB* of videos to delete!" #Ask about if can erase if [ -z "$DL" ]; then read -p "Can I delete the selected files? [Y/n]" -n 1 DL fi #Delete files? Are you sure? if [ "$DL" == "Y" ]; then echo "Wait! Deleting the selected files..." echo "This process can take long time!" find $VIDEO_CACHE_DIR -mtime +$DAYS -exec rm -rf {} \; fi
