Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Zip files in a folder into monthly archives

Aug
1
0
I am looking to traverse files in a folder and move them into monthly zip files (yyyy-mm.zip) based on the files creation dates. Looking at the documentation I can see how its possible to create zip archives and how potentially date ranges could be used to select the list of files that need moved into each zip archive I create. What I am struggling with is how to traverse the folder containing the list of files and construct valid date ranges for each year/month. My assumption is that dates used in date ranges need to be valid, so say 2024-02-31 would not be allowed?

My initial thought in how to do this left me looking for functions which don't appear to exist:-

1. %@ymd[%y,%m,%d] --construct a date from year, month and day values.
2. %dateAdd[%dt,-1,m] --subtract 1 month from date.

Hopefully somebody can point me in the right direction to achieve this in a BTM script.

TIA.
 
My initial thought in how to do this left me looking for functions which don't appear to exist:-

1. %@ymd[%y,%m,%d] --construct a date from year, month and day values.

That one is easy. As long as you're using four-digit years, you can just concatenate them with hyphens in between: %y-%m-%d

TCC will interpret this as an ISO8601 date. To be formally correct, the month and day should be left-padded to two digits with a zero; but TCC does not actually require this.

2. %dateAdd[%dt,-1,m] --subtract 1 month from date.

How about a function to report the number of days in a given month? https://charlesdye.net/plugins/iso8601.html#f_monthlen
 
Back
Top
[FOX] Ultimate Translator
Translate