How to deleting local files during comparison

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • machete
    Visitor
    • Dec 2018
    • 7

    How to deleting local files during comparison

    Hello,

    I am a novice user of BC3 scripting - enough to write scripts to copy local files up via FTP, basic stuff. The script I am working with is as follows:
    - Load Directory
    - Filter for a set of files
    - Compress and Copy filtered files into myfiles_%date%.zip
    - Load FTP Session
    - Set Folders
    - Copy via FTP

    What's missing is a way to delete older myfiles_%date%.zip

    So this script has been running for 2 years and I have 600+ .zip files locally... I only want to keep about a month's worth of local files. Is there way to automate this in my script? I am hoping to keep this process contained in one place/script.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16026

    #2
    You could load a specific target folder that contains only your .zip backups, and have a date filter in place to exclude all 1 month or newer files (so only old files remain), then select and delete them.

    Since actions cannot be Undone, and script does not preview before committing actions, I would strongly recommend setting up a pair of test folders to step through any new script changes, just in case something isn't set up quite right in the filtering, and you accidentally delete unexpected files. You can also generate a report first to verify only the visible files you want to select and delete are present.

    filter "backupname*.zip"
    filter cutoff:>30days
    load create:all "C:\test folder of backup sample zips"
    expand all
    folder-report layout:side-by-side output-to:"C:\scripting\report.html" output-options:html-color
    Aaron P Scooter Software

    Comment

    Working...