Use forfiles to delete a folder and its contents
<p>I am attempting to purge a public directory, so when an item is older than 30 days it should be deleted. I have a batch file setup with the following command:</p>

<pre><code>forfiles /p "C:\PATH\USERS\PATH\" /s /m *.* /c "cmd /c Del @path /q" /d -30
</code></pre>

<p>This works great. However, the issue is, that it only deletes the items within the folders within the path.</p>

<p>Example: <code>C:\PATH\USERS\PATH\HelloWorld\file.text</code> is over 30 days old. But the command only deletes <code>file.text</code>, not the folder.</p>

<p>Would I have to check to see if the folder is empty and then delete the folder with another command?</p>