#!/bin/bash # vim: set sts=4 ts=4 sw=4: TV_RECORD_DIR=${TV_RECORD_DIR:-/freevo/tv} TV_RECORD_DIR="/freevo/record /freevo/tv" OVERLAY_DIR=${OVERLAY_DIR:-/freevo/overlay} TMP_LIST_FILE=/tmp/${0##*/}.$$ # remove empty files if [ "$1" == "yes" ]; then for f in $(find ${TV_RECORD_DIR} -size 0); do rm -fv ${f} #rm -fv ${OVERLAY_DIR}${f%.*}.fxd.raw done else for f in $(find ${TV_RECORD_DIR} -size 0); do echo "${f} will be removed, it's empty." #echo "${OVERLAY_DIR}${f%.*}.fxd.raw" done fi # find files with out fxd #find ${TV_RECORD_DIR} -depth -type f | sed 's/\([^/]\)\.[^.]*$/\1/' | sort | uniq > ${TMP_LIST_FILE} find ${TV_RECORD_DIR} -depth -type f | sed 's/\([^/]\)\(-...\)*\.[^.]*$/\1/' | sort | uniq > ${TMP_LIST_FILE} for f in $(cat ${TMP_LIST_FILE}); do # skip files that start with a "." if /bin/echo "${f##*/}" | /bin/grep -q "^\..*"; then continue fi if [ "${f##*/}" == "cover" ]; then continue fi if [ "${f##*/}.jpg" == "cover-f.jpg" ]; then continue fi if [ "${f##*/}.fxd" == "folder.fxd" ]; then continue fi # if [ -e $f.fxd -a \( -e $f.mpeg -o -e $f.avi -o -e $f.mkv \) ]; then continue fi if [ "$1" == "yes" ]; then rm -fv $f* #rm -fv ${OVERLAY_DIR}${f}.fxd.raw else for n in $f*; do echo "${n} will be removed." done fi done #cat ${TMP_LIST_FILE} rm -f ${TMP_LIST_FILE}