Hi,
I have files concatenated with day of the year in a folder.
Say as
Jan 1st - aaa.001.txt
Feb 3rd - aaa.034.txt etc.
which I get with `date +%j`
I now need to archive files older than a month. my program works for forward dates other than January.
Being in Feb, I can delete files older than 30 day by taking few constant values in variables and negating with current date value.
However, being in Jan, my approach fails to archive last year's data. i.e. 335 --> 365.
Note: the script should run when ever we trigger and it should ensure to retain 1 month's data and delete rest of the old files.
Please help. Thanks in advance.
I can paste my code copy if required.
I have files concatenated with day of the year in a folder.
Say as
Jan 1st - aaa.001.txt
Feb 3rd - aaa.034.txt etc.
which I get with `date +%j`
I now need to archive files older than a month. my program works for forward dates other than January.
Being in Feb, I can delete files older than 30 day by taking few constant values in variables and negating with current date value.
However, being in Jan, my approach fails to archive last year's data. i.e. 335 --> 365.
Note: the script should run when ever we trigger and it should ensure to retain 1 month's data and delete rest of the old files.
Please help. Thanks in advance.
I can paste my code copy if required.