<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>deleting directory</title>
		<link>http://www.allegro.cc/forums/view/609309</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 16 Jan 2012 01:55:37 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>hi guys,</p><p> is there a way to delete a directory and all it&#39;s contents with A5 ?</p><p>Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 13:30:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you could somehow invoke dos commands from A5 sure.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (verthex)</author>
		<pubDate>Sun, 15 Jan 2012 13:33:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, by recursively looking through a directory using <span class="source-code"><a href="http://www.allegro.cc/manual/al_open_directory"><span class="a">al_open_directory</span></a></span> /<span class="source-code"><a href="http://www.allegro.cc/manual/al_read_directory"><span class="a">al_read_directory</span></a></span> (using <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_fs_entry_mode"><span class="a">al_get_fs_entry_mode</span></a></span> to tell if the current entry is a directory and needs to be recursed into) and then using <span class="source-code"><a href="http://www.allegro.cc/manual/al_remove_fs_entry"><span class="a">al_remove_fs_entry</span></a></span> to actually delete the file/empty directory.</p><p>There&#39;s obviously no convenience function for that, but doing the above shouldn&#39;t take more than 10-20 lines.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sun, 15 Jan 2012 13:40:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks.</p><p>Maybe it&#39;d be easier to do with a scipt ?</p><p>I&#39;m using a script to compile and run my program.</p><p>I&#39;ve tried using the rmdir command but it says command not found, even though it&#39;s in the bash docs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 13:45:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, in that case you&#39;d use rm:</p><pre class="terminal">rm -rf directory_name</pre><p>

Be careful with what you put in the directory_name lest you delete something you didn&#39;t want to delete.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sun, 15 Jan 2012 13:55:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Thanks. Still getting a command not found.</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#!bin/bash</span>
rm <span class="k3">-</span>rf <span class="s">"C:\pongping8\feature_hits_circle_dir_01"</span> 

cd C:<span class="k3">/</span>pongping8
<span class="k1">if</span> mingw32-make 
then 
.<span class="k3">/</span>pong_game.exe 
fi
<a href="http://www.delorie.com/djgpp/doc/libc/libc_642.html" target="_blank">read</a> <span class="k3">-</span>p <span class="s">"press a key"</span>
</pre></div></div><p>




C:\pongping8\make_pongping.sh: line 2: rm: command not found<br />mingw32-make: `pong_game.exe&#39; is up to date.<br />Press any key to continue . . .
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 14:00:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;re using bash... on Windows? That&#39;s surprising.</p><p>You&#39;ll need to find the Windows equivalent then, I guess. <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sun, 15 Jan 2012 14:02:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
On Windows, MSYS can be used to use the bash commands. Although I only get this when I call it from MSYS :</p><p>william@william-PC ~<br />$ cd C:/pongping8</p><p>william@william-PC /c/pongping8<br />$ ./make_pongping.sh<br />sh: ./make_pongping.sh: bin/sh^M: bad interpreter: No such file or directory</p><p>william@william-PC /c/pongping8<br />$
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 14:09:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Shouldn&#39;t that be /bin/sh?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (J-Gamer)</author>
		<pubDate>Sun, 15 Jan 2012 17:09:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t know. I changed it to that to see if it would work. I&#39;ve changed it back and I still get the same output.<br />I&#39;ve never know wht that line does.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 18:22:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It tells the system that the program should be opened with bin/sh. As it seems it is already being opened with sh, try removing the line.(I&#39;m just guessing here)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (J-Gamer)</author>
		<pubDate>Sun, 15 Jan 2012 19:00:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Okay, I tried that but I still get this :</p><p>C:\pongping8\make_pongping.sh: line 2: rm: command not found<br />mingw32-make: `pong_game.exe&#39; is up to date.<br />Press any key to continue . . .</p><p>Haven&#39;t got a clue why it&#39;s not found.</p><p>I must be doing something stupid.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 20:07:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This file works for me in Ubuntu 11.10.
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#!/bin/sh</span>
touch <span class="s">"blargh"</span>
rm blargh
</pre></div></div><p>
Does msys have rm? Try the steps of the program manually on the command-line.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (J-Gamer)</author>
		<pubDate>Sun, 15 Jan 2012 20:15:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Manually it works okay but not from the script.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 21:05:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>On Windows, I think the command is &#39;rmdir&#39; if you&#39;re on Windows maybe that&#39;s why it is not working?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Sun, 15 Jan 2012 21:51:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tried that. command not found again.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 22:32:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>rd?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dario ff)</author>
		<pubDate>Sun, 15 Jan 2012 22:34:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As well as to be restricting yourself to Windows, you might as well do it right and use RemoveDirectory <a href="http://msdn.microsoft.com/en-us/library/aa365488%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/aa365488%28VS.85%29.aspx</a></p><p>Or this for non-empty directories:
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k1">void</span> silently_remove_directory<span class="k2">(</span>LPCTSTR dir<span class="k2">)</span> <span class="c">// Fully qualified name of the directory being deleted, without trailing backslash</span>
<span class="number">  2</span><span class="k2">{</span>
<span class="number">  3</span>    SHFILEOPSTRUCT file_op <span class="k3">=</span> <span class="k2">{</span>
<span class="number">  4</span>        NULL,
<span class="number">  5</span>        FO_DELETE,
<span class="number">  6</span>        dir,
<span class="number">  7</span>        <span class="s">""</span>,
<span class="number">  8</span>        FOF_NOCONFIRMATION <span class="k3">|</span>
<span class="number">  9</span>        FOF_NOERRORUI <span class="k3">|</span>
<span class="number"> 10</span>        FOF_SILENT,
<span class="number"> 11</span>        <span class="k1">false</span>,
<span class="number"> 12</span>        <span class="n">0</span>,
<span class="number"> 13</span>        <span class="s">""</span> <span class="k2">}</span><span class="k2">;</span>
<span class="number"> 14</span>    SHFileOperation<span class="k2">(</span><span class="k3">&amp;</span>file_op<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span><span class="k2">}</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Sun, 15 Jan 2012 22:46:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/609309/944201#target">jmasterx</a> said:</div><div class="quote"><p>On Windows, I think the command is &#39;rmdir&#39;</p></div></div><p>
<tt>rd</tt>.<br /><tt>rd /s</tt> for a recursive delete including all files (equivalent to UNIX&#39;s <tt>rm -r</tt>). <tt>rd /s /q</tt> for recursive delete in quiet mode (don&#39;t ask for permission before deleting stuff - equivalent to UNIX&#39;s <tt>rm -rf</tt>).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Sun, 15 Jan 2012 22:57:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://stackoverflow.com/questions/2192415/unlink-vs-remove-in-c">Remove</a> is portable, and although I haven&#39;t tried to <i>use</i> it in that fashion, is supposedly able to remove directories as well as files. I&#39;m not sure if it can get the directory and all the files in one shot, but it&#39;d be worth trying.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Sirocco)</author>
		<pubDate>Sun, 15 Jan 2012 23:39:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks jmasterx.</p><p>I got that to work..</p><p>I&#39;m still puzzled about why none of rm -rf, rmdir, or rd work when other commands like</p><p>cd work fine.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (William Labbett)</author>
		<pubDate>Sun, 15 Jan 2012 23:55:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This SO post might help:<br /><a href="http://stackoverflow.com/questions/1201602/cywin-bash-script-command-not-found-when-called-from-batch">http://stackoverflow.com/questions/1201602/cywin-bash-script-command-not-found-when-called-from-batch</a><br />Conclusion: put cygwin in your PATH
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (J-Gamer)</author>
		<pubDate>Sun, 15 Jan 2012 23:58:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><a href="http://www.delorie.com/djgpp/doc/libc/libc_802.html" target="_blank">system</a><span class="k2">(</span><span class="s">"rmdir /s /q directory_to_delete"</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 16 Jan 2012 01:14:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>cd works because it&#39;s both a bash and cmd.exe command. rmdir and rd don&#39;t work in bash because they&#39;re not bash commands. rm doesn&#39;t work because you don&#39;t have rm installed. You can get many unix utils like rm for Windows <a href="http://sourceforge.net/projects/unxutils/">here</a>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Mon, 16 Jan 2012 01:49:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think the question is why doesn&#39;t a .sh script using rm work in MSYS, when it already has rm. And it should work...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 16 Jan 2012 01:55:37 +0000</pubDate>
	</item>
</rss>
