Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Default Delete older than (xy) deletes everything

    I tried to write a script that deletes all files older than 7 days from a directory.

    Code:
    load "G:\BACKUP TEST 7 TAGE"
    expand all
    filter cutoff:>7days
    select all
    delete recyclebin=no all
    If I execute the script once, all files older than 7 days are deleted. If I execute the script a second time, the newer files are also deleted. I found out that:
    - if a directory contains one or more older file -> the older files are deleted correctly
    - if a directory contains only newer files -> the whole directory is deleted

    Note: the following Knowledge Base article affects this topic, I think I followed the sequence described there:
    http://www.scootersoftware.com/suppo...kb_filters.php

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,584

    Default

    Hi keen4000,

    Changing your selection to all.files should help with the problem.

    Here's the edited script:

    load "G:\BACKUP TEST 7 TAGE"
    expand all
    filter cutoff:>7days
    select all.files
    delete recyclebin=no all

    Please let us know if the change doesn't help.
    Chris K Scooter Software

  3. #3
    Join Date
    Jan 2010
    Posts
    2

    Default Short-term backup

    Grrreat!!
    Thanks Chris for your solution.
    Here is my complete script, it does a short-term-backup which only contains the newest files (newer than 7 days):
    Code:
    # load original and backup directory
    load "D:\BACKUP TEST" "G:\BACKUP TEST 7 TAGE"
    expand all
    
    # backup new files (only files that are newer than 7 days)
    filter cutoff:<7days
    sync update:left->right
    
    # delete old files from backup (files that are older than 7 days)
    filter cutoff:>7days
    select rt.files
    delete recyclebin=no rt
    
    # cleanup (delete empty directories)
    filter cutoff:none
    select rt.empty.folders
    delete recyclebin=no rt

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •