Announcement

Collapse
No announcement yet.

Delete older than (xy) deletes everything

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment

      Working...
      X