Posts tagged ‘vuplus’

Enigma2 OpenEmbedded Enhanced Movie Center Trashfolder CleanUp

We own a great VuPlus Solo2 Linux based Satelit Receiver. We record some series and films and then delete them. The deleted media files are not deleted directly when using EMC to view and delete. The media files are moved to a trash folder first and should be automatically deleted after x days. But that does not work for whatever reason.

Recently I checked the trash folders I found, as I wondered why the box’s hard disk is getting filled up. And I found many, many old ‘deleted’ files, that are not removed from the hard disk.

I decided to write my own script (/home/root/deltrasholder7days.sh, yes, there is a typo ;-)) ) to finally remove ‘deleted’ files after 7 days. The script was then added to the root’s crontab.

#!/bin/sh
# delete old files
# delete trash files older than 7 days
/usr/bin/find /mnt/hdd/movie_trash -type f -mtime +7 -delete
/usr/bin/find /mnt/hdd/movie/trashcan -type f -mtime +7 -delete
cd /mnt/hdd/movie_trash/
rm last_cleanup*
touch last_cleanup_$( date '+%Y-%m-%d_%H-%M-%S' )
cd /mnt/hdd/movie/trashcan/
rm last_cleanup*
touch last_cleanup_$( date '+%Y-%m-%d_%H-%M-%S' )

The script deletes all files at /mnt/hdd/movie_trash and /mnt/hdd/movie/trashcan with a modification date of 7 days before current day. Then it adds a file with a timestamp as name to let me know, that the script has worked at what time.
… and the crontab (/etc/cron/crontabs/root):

1 1 * * * /home/root/deltrasholder7days.sh

This starts the script every day at 1pm.

That’s all, thank’s to the author of the find utility.