Batch command to check for partial filename then delete
<p>I am trying to create a batch file that will search through a 3.5 TB partition and remove all files with a partially matching file name. </p>

<p>Our file structure is set up as a 5 digit item number then a possibly very random suffix before the extension. For example:</p>

<pre><code>54326.jpg
54326 5x6.jpg
54326 (OLD ART).jpg
</code></pre>

<p>This has occurred through endless neglect of adherence to naming conventions and now we are about to purge the system of allot of random data. To make the problem harder it is scattered between 4 drives and a total of roughly 300,000 folders.</p>

<p>I was able to find this code from another forum but instead of moving it to another folder i just want to delete ALL instances using the item number.</p>

<pre><code>for /r %%x in (54326*.*) do move "%%x" "DESTINATION"
</code></pre>

<p>I need the code to delete all files (of various extensions) using the 5 digit partial name from all folders on a hard drive.</p>

<p>I am using excel to group the code together as this will be done to roughly 25,000 product numbers. I am going to be given a list of product numbers to delete from. this list can be turned into a <code>.txt</code> file if the code can index that <code>txt</code> file in order to get the names to make things more simple.</p>