bash-onedrive-upload icon indicating copy to clipboard operation
bash-onedrive-upload copied to clipboard

Delete old files after a successful upload (aka backup mode)

Open fkalis opened this issue 10 years ago • 1 comments

When uploading backups on a regular basis it is useful to delete old backups after a successful upload, e.g. doing backups on a daily basis and only keeping these for a week.

Things to think about:

  • How to activate this feature via commandline
    • for example --backupmode --max-age 7d
  • How to determine which files to delete
    • Checking for items in the backup base root

A full call could look like this

$ ./bash-onedrive-upload \
--backup-mode \                      # Activate backup mode
--backup-basedir myBackups \         # Use remote folder myBackups as the backup root folder
--backup-date-pattern '+%Y-%m-%d' \  # Create a subfolder with this name in the backup base dir
--backup-max-age 7d \                # Delete all files older than 7 days after a successful upload
myBackupFiles.gpg                    # Upload these files

fkalis avatar May 16 '15 13:05 fkalis

Hi! I actually need something that will delete the files after successful upload. I have a cron job that basically goes into a folder and uploads everything to onedrive. I don't need anything fancy - simply delete whatever was just uploaded.

How difficult would it be to implement something like that? Thanks!

altamira2050 avatar Mar 22 '18 12:03 altamira2050