title: Shell script to archive & delete files older than 5 days based on created date of the files
body: <p>I am trying to compress 5 days' worth log at a time and moving the compressed files to another location and deleting the logs files from original location. I need bash script to accomplish this. I got the files compressed using the below command, but not able to move them to the archive folder. I also need to compress based on date created. Now it's compressing all the files starting with a specific name.</p>
  
  <pre><code>#!/bin/bash
  cd "C:\Users\ann\logs"
  for filename in acap*.log*; do
  # this syntax emits the value in lowercase: ${var,,*}  (bash version 4)
  mkdir -p archive
   gzip  "$filename_.zip" "$filename"
  mv "$filename" archive
  
  done
  </code></pre>