UNPKG

bapuli

Version:
31 lines (25 loc) 847 B
"use strict"; const cmd = 'touch'; const now = new Date(); let lastYear = now.getFullYear(); for (let year = 1975; year <= lastYear; year++) { let lastMonth = year == lastYear ? now.getMonth() : 12; for (let month = 1; month <= lastMonth; month++) { let mpad = month < 10 ? "0" : ""; let monthLength = [ null, 31, 28+!(year % 4), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ][month]; let lastDay = year == lastYear && month == lastMonth ? now.getDay() : monthLength; for (let day = 1; day <= lastDay; day++) { let dpad = day < 10 ? "0" : ""; console.log ( cmd + " " + "DemoFile_" + year + mpad + month + dpad + day + "_bkp.tar.gz" ); }; }; };