jeff.lebowski Posted May 27, 2016 Share Posted May 27, 2016 Every day at 03:00, Kodi runs a backup and saves the folder to an unRAID server. yyyymmdd0300 is the name, with the date changing for every new backup. I just deleted 201605260300, leaving 201605270300 as the only directory. Currently, I'm just opening a PuTTY window and running 'rm -rf dirname' every morning. It's about 5gb and ~70,000 files, so Windows take a LONG time to delete across the network when using Total Commander. I'd like to automate this process, taking great care to leave today's backup but deleting the yesterday's files. Saving location: mnt/user/Backup but I should probably make it's own share so nothing else goes there. I've looked at a few scripts, but they haven't accounted for a dir name that changes. At least the scripts I've found... Quote Link to comment
ken-ji Posted May 27, 2016 Share Posted May 27, 2016 a quick script to run after the backup #!/bin/bash YESTERDAY=`date +%Y%m%d --date yesterday` BACKUPDIR=/mnt/usr/Backup BACKUP=${BACKUPDIR}/${YESTERDAY}0300 rm -fr ${BACKUP} of course i'd try it first with 'ls' in place of the 'rm -fr' Quote Link to comment
jeff.lebowski Posted May 27, 2016 Author Share Posted May 27, 2016 a quick script to run after the backup #!/bin/bash YESTERDAY=`date +%Y%m%d --date yesterday` BACKUPDIR=/mnt/usr/Backup BACKUP=${BACKUPDIR}/${YESTERDAY}0300 rm -fr ${BACKUP} of course i'd try it first with 'ls' in place of the 'rm -fr' Thanks, ken-ji. I'll give it a try. Quote Link to comment
mrow Posted May 30, 2016 Share Posted May 30, 2016 Back when I used Kodi/XBMC I used an add-on that handled backing up the library to a share on my server for me. It had options to set how many backup copies you wanted to keep and it would delete anything older above that set threshold automatically. I don't remember exactly what the name was but I found it in the built in list of available add-one. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.