shutil.rmtree(<path>) <spanclass="hljs-comment"># Deletes the entire directory tree.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs">os.rename(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Renames the file or directory.</span>
os.replace(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
<pre><codeclass="python language-python hljs">os.rename(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Renames the file or directory.</span>
os.replace(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs">os.mkdir(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates a directory.</span>
<iter> = os.scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns os.DirEntry objects located at path.</span>
<pre><codeclass="python language-python hljs">os.mkdir(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates a directory.</span>
<iter> = os.scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns os.DirEntry objects located at path.</span>
</code></pre>
</code></pre>
<h4id="direntry">DirEntry:</h4>
<h4id="direntry">DirEntry:</h4>
<pre><codeclass="python language-python hljs"><str> = <DirEntry>.name <spanclass="hljs-comment"># Final component of the path.</span>
<str> = <DirEntry>.path <spanclass="hljs-comment"># Path with final component.</span>