title: Folder seems to exist in OS but fails silently upon `sudo rm -rf dirname`
body: <p>I am trying to delete a folder, but failing to do so. I am sudo, and have all permissions.</p>
  <p><code>cd /path/to/parent</code></p>
  <p><code>ls</code></p>
  <pre><code>001  003  005  007  009  011  013  015  017  019  021                 dent_detections_3d.ply      dent_spread_debug.png             paint_chip_spread_debug.png
  002  004  006  008  010  012  014  016  018  020  _det__grouped.json  dent_detections_debug.json  paint_chip_detections_debug.json
  </code></pre>
  <p>I want to delete <code>003</code> which is the problematic folder. Other folders behave normally.</p>
  <p>Observations:</p>
  <ol>
  <li><code>cd 003</code> gives <code>-bash: cd: 003: No such file or directory</code></li>
  <li><code>sudo rm -rf 003</code> or <code>sudo rm -rf 003/</code> gives empty output, then <code>ls</code> gives the same as above (<code>003</code> exists).</li>
  <li></li>
  </ol>
  <pre><code>python
  &gt; import os
  &gt; path.os.exists(&quot;path/to/parent&quot;)
  &gt;&gt; True
  &gt; path.os.exists(&quot;path/to/parent/003&quot;)
  &gt;&gt; False
  &gt; os.mkdir(&quot;path/to/parent/003&quot;)
  &gt;&gt; 
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  OSError: [Errno 17] File exists: '/path/to/parent/003'
  </code></pre>
  <p>What may be causing this? How to debug this? I want the folder removed, and I need this to not happen again.</p>
  <hr />
  <p>EDIT to answer comments:</p>
  <pre><code>&gt; ls -la
  
  total 6144
  drwxr-xr-x 2 noam root      0 Dec 28 13:28 .
  drwxr-xr-x 2 noam root      0 Dec  9 18:41 ..
  drwxr-xr-x 2 noam root      0 Dec 28 13:28 001
  drwxr-xr-x 2 noam root      0 Dec 28 13:28 002
  drwxr-xr-x 2 noam root      0 Dec 28 13:28 003
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 004
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 005
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 006
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 007
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 008
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 009
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 010
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 011
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 012
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 013
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 014
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 015
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 016
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 017
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 018
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 019
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 020
  drwxr-xr-x 2 noam root      0 Dec 28 13:26 021
  -rwxr-xr-x 1 noam root 684753 Dec 12 11:58 _det__grouped.json
  -rwxr-xr-x 1 noam root   7604 Dec 12 11:58 dent_detections_3d.ply
  -rwxr-xr-x 1 noam root  89902 Dec 12 11:58 dent_detections_debug.json
  -rwxr-xr-x 1 noam root 377863 Dec 12 11:58 dent_spread_debug.png
  -rwxr-xr-x 1 noam root     24 Dec 12 11:58 paint_chip_detections_debug.json
  -rwxr-xr-x 1 noam root 362525 Dec 12 11:58 paint_chip_spread_debug.png
  
  </code></pre>
  <hr />
  <p>EDIT2 with the information that a race-condition is the problem</p>
  <p>Relevant code chunk that creates the folder:</p>
  <pre><code>if os.path.exists(cluster_folder_path):
      shutil.rmtree(cluster_folder_path)
  os.mkdir(cluster_folder_path)
  </code></pre>