title: delete duplicate file based on modified time, limited by minutes
body: <p>I have a webcam that is uploading a image every few minutes via FTP into a directory. The webcam unfortunately has a bug which uploads two images at once. (the vendor does not want to fix it...). The image is still different so I can <strong>not</strong> check the md5sum of the .jpg and delete the duplicated one.</p>
  <p>The filename of the image is similar, but still different. It looks like this:</p>
  <ul>
  <li>Jan  3 09:43 <strong>image220103_094305_20.jpg</strong></li>
  <li>Jan  3 09:43 <strong>image220103_094306_00.jpg</strong></li>
  </ul>
  <p>The format is as follows:</p>
  <p>imageYYMMDD_HHMMSS_??.jpg</p>
  <p>My goal is to keep the first uploaded image and delete the second one.</p>
  <p>My idea was to use &quot;stat&quot; and check the modified time. However, stat goes very much into detail and even shows the seconds when it was uploaded. So my question is:</p>
  <p>Is it possible to limit the time when it was modified to minutes? I don't care about the seconds or further.</p>
  <p>If two images get uploaded at 09:43, I want to delete the last one.</p>
  <p>The bash script will be executed via a crontab every hour.</p>
  <p>My approach would be:</p>
  <ul>
  <li>List all files in the directory and their modified time, limited until minutes (don't show seconds)</li>
  <li>If there are any files with the same modified time, delete the last one of the result</li>
  </ul>