Compress all files in directory based on days months or years

Hi everyone, I needed a function that compresses all my…