title: Specific timing of a subprocess yields undesireable results
body: <p>My goal is to have this script run on a remote computer and at a 'specific' time, execute the subprocess (one time) every hour.  The script runs as expected until the it's time to run the subprocess.  Instead of executing one file at a time, it runs all the files without stopping.  I also tried using various sleep times to break the cycle, to no avail.
  Here is the script:</p>
  <pre><code>import time
  import os
  import subprocess
  
  print(&quot;Waiting To Upload File ... &quot;)
  PATH = r'C:\Users\trcyp\Documents\PythonExample'
  while True:
      r = time.localtime()
      m = r.tm_min
      s = r.tm_sec
      if m == 43 and s == 0: #I want to run the script below at this specific min/sec.
          for root, subFolder, files in os.walk(PATH):
              files.sort(key=str.lower)
              subFolder.sort()
              for item in files:
                  fileNamePath = os.path.join(root, item)
                  print(&quot;Uploading: &quot; + fileNamePath)
                  print(&quot;This is where my subprocess would be&quot;)
                  #os.remove(fileNamePath)
                  print(&quot;Upload Successful, &quot; + time.asctime())
                  time.sleep(1)
      else:
          print(&quot;Current m/s&quot;, m, ':', s, &quot;\r&quot;, end=&quot;&quot;)
          time.sleep(1)
  </code></pre>
  <p>And here is my output:</p>
  <pre><code>Waiting To Upload File ... 
  Uploading: C:\Users\trcyp\Documents\PythonExample\CustomLoadSheet.pdf
  This is where my subprocess would be
  Upload Successful, Sun Feb 21 11:43:00 2021
  Uploading: C:\Users\trcyp\Documents\PythonExample\Default.aspx.pdf
  This is where my subprocess would be
  Upload Successful, Sun Feb 21 11:43:01 2021
  Uploading: C:\Users\trcyp\Documents\PythonExample\DeliveryDetail(2).pdf
  This is where my subprocess would be
  Upload Successful, Sun Feb 21 11:43:02 2021
  Uploading: C:\Users\trcyp\Documents\PythonExample\DeliveryDetail.pdf
  This is where my subprocess would be
  Upload Successful, Sun Feb 21 11:43:03 2021
  Uploading: C:\Users\trcyp\Documents\PythonExample\ESP8266ModuleV1.pdf
  This is where my subprocess would be
  Upload Successful, Sun Feb 21 11:43:04 2021
  Uploading: C:\Users\trcyp\Documents\PythonExample\track.pdf
  This is where my subprocess would be
  Upload Successful, Sun Feb 21 11:43:05 2021
  Current m/s 43 : 19 
  </code></pre>
  <p>I've used multiple configurations, but I'm still stuck. The original (<a href="https://stackoverflow.com/questions/66095316/sorting-a-list-of-files-to-be-uploaded-in-order">Sorting a list of files to be uploaded in order</a>) version of the script worked perfectly, but using <code>time.sleep()</code> caused the time the subprocess was executed to slowly move around the clock.  I'm trying to have it run one file at a time, at the same time, every time.</p>