Announcement

Collapse
No announcement yet.

Delete files based on date

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

  • Delete files based on date

    I want to sync a local folder to a file share , but I also only want to keep files that are more recent than 3 years (i.e. remove files older than 3 years from both source and destination).

    I have downloaded a trial copy of BC4 and have got the file sync part working fairly easily, however, I'm not sure of the syntax for the deletion part in a script and could do with some help please?

    Also, it would be nice if the sync and delete were part of the same script. Logically I would want to put the delete before the sync, so as to avoid unnecessary copying from the source to the destination. Is this assumption correct?

    Many thanks,
    Jazzaid

  • #2
    Hello,

    First, a quick tip: Script does not preview an action before committing it and BC4 does not offer Undo support. I would strongly recommend working with test folders first, as a small syntax error could result in accidentally deleting unintended files.

    Script is sequential, so you can run a load, then a select and delete, then a new filter and then sync, all as a single set of steps. Similar to above, I'd recommend working with just one step at a time (a script that loads and prunes out 3 year old files) first.

    Before creating the script, please use the graphical interface and set the filtering in the Folder Compare's Session menu -> Session Settings, Other Filters, to Exclude timestamps Newer than 3 years ago. This should leave you with a view of only the older files, so you can verify that this is the expected file list. You can then create a script which will load and filter the same set, select all to delete them, then reset the filter with filter cutoff:none.

    load "folder1" "folder2"
    filter cutoff:>1095days
    folder-report layout:side-by-side output-to:"d:\bcreport1.html" output-options:html-color
    filter cutoff:none
    folder-report layout:side-by-side output-to:"d:\bcreport2.html" output-options:html-color
    Aaron P Scooter Software

    Comment

    Working...
    X