<?xml version="1.0" encoding="windows-1252"?>
<node id="1010862" title="Re: removing directories with wildcard glob in OS-portable way" created="2012-12-29 19:14:38" updated="2012-12-29 19:14:38">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;Please tell me I'm over-thinking this!&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;You're over thinking this! :) Or rather, going about things the hard way.

&lt;p&gt;Assuming the command you gave does what you need everywhere bar Windows, just use this when you detect Windows:&lt;code&gt;
system qq[ for /d %d in ($tmp\\scale-*) do @rd /q /s %d ];
&lt;/code&gt;

&lt;p&gt;Eg:&lt;code&gt;
C:\test&gt;dir /b /s ppp
C:\test\ppp\donttouch
C:\test\ppp\scale-123
C:\test\ppp\scale-124
C:\test\ppp\scale-125
C:\test\ppp\donttouch\junk.1
C:\test\ppp\scale-123\junk
C:\test\ppp\scale-123\junk\junk.1
C:\test\ppp\scale-123\junk\junk.2
C:\test\ppp\scale-123\junk\junk.3
C:\test\ppp\scale-124\junk
C:\test\ppp\scale-124\junk\junk.1
C:\test\ppp\scale-124\junk\junk.2
C:\test\ppp\scale-124\junk\junk.3
C:\test\ppp\scale-125\junk
C:\test\ppp\scale-125\junk\junk.1
C:\test\ppp\scale-125\junk\junk.2
C:\test\ppp\scale-125\junk\junk.3

C:\test&gt;for /d %d in (ppp\scale-*) do rd /q /s %d

C:\test&gt;rd /q /s ppp\scale-123

C:\test&gt;rd /q /s ppp\scale-124

C:\test&gt;rd /q /s ppp\scale-125

C:\test&gt;dir /b /s ppp
C:\test\ppp\donttouch
C:\test\ppp\donttouch\junk.1
&lt;/code&gt;


&lt;P&gt;Why reinvent an operation that the OS already knows how to do?

&lt;div class="pmsig"&gt;&lt;div class="pmsig-171588"&gt;
&lt;hr /&gt;
&lt;font size=1 &gt;
&lt;div&gt;With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'&lt;/div&gt;
&lt;div&gt;Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.&lt;/div&gt;
&lt;div&gt;"Science is about questioning the status quo. Questioning authority". &lt;/div&gt;
&lt;div&gt;In the absence of evidence, opinion is indistinguishable from prejudice.
&lt;/div&gt;
&lt;/font&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1010858</field>
<field name="parent_node">
1010858</field>
</data>
</node>
