<html><head><style type="text/css">body{font:12px Arial;margin:3px;overflow-y:auto;overflow-x:auto}p{margin:0px;}blockquote, ol, ul{margin-top:0px;margin-bottom:0px;}</style></head>

<body><div style="DISPLAY: block; FONT-SIZE: 12px; FONT-FAMILY: Arial"><P>Hallo everybody!</P>
<P>&nbsp;</P>
<P>I have downloaded the file in the link down below.</P>
<P><A href="http://www.bsdg.org/SWAG/DIRS/0006.PAS.html">http://www.bsdg.org/SWAG/DIRS/0006.PAS.html</A></P>
<P>&nbsp;</P>
<P>I use dev-pascal 1.9.2 as ide for my pascal programming. I have made a little modifications of the file. </P>
<P>It works perfect if I use it as a "single" file, not in a project. But if I use it in a project it only searches the first </P>
<P>and only the first directory, and deletes files from it. When it tries to remove a directory which is empty it can't and gives a runtime 5 error and stops.</P>
<P>&nbsp;</P>
<P>Do&nbsp;anyone have any idea why the error occurs and why the program in a project can't remove directories?</P>
<P>&nbsp;</P>
<P>here is the code :</P>
<P>&nbsp;</P>
<P>Program deleteDirectory;<BR></P>
<P>uses Dos;</P>
<P>Procedure ClrDir ( path : pathStr );</P>
<P>Var FileInfo : searchRec;<BR>&nbsp;&nbsp;&nbsp; f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : File;<BR>&nbsp;&nbsp;&nbsp; path2&nbsp;&nbsp;&nbsp; : pathStr;<BR>&nbsp;&nbsp;&nbsp; s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : String;</P>
<P>begin FindFirst ( path + '\*.*', AnyFile, FileInfo );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; While DosError = 0 Do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin if (FileInfo.Name[1] &lt;&gt; '.') and (FileInfo.attr &lt;&gt; VolumeId) then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( (FileInfo.Attr and Directory) = Directory ) then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin Path2 := Path + '\' + FileInfo.Name;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClrDir ( path2 );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((FileInfo.Attr and VolumeID) &lt;&gt; VolumeID) then begin<BR>&nbsp;&nbsp;&nbsp
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assign ( f, path + '\' + FileInfo.Name );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Erase ( f );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FindNext ( FileInfo );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (DosError = 18) and not ((Length(path) = 2)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and ( path[2] = ':')) then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RmDir ( path );</P>
<P>end;</P>
<P>begin</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; ClrDir('c:\temp\somedirectory');</P>
<P>end.</P>
<P>&nbsp;</P>
<P>Martin<BR></P></br><p style="margin-top:11px;padding-top:3px;background-image: url(http://mail.lycos.co.uk/Images/Mail/_content/dot.gif);background-repeat: repeat-x;background-position: 0px 0px;">Online Virus Test: Scanna din computer GRATIS <a href="http://ads.lycos-europe.com/event.ng/Type=click&FlightID=166707&AdID=369873&TargetID=59790&Segments=48125&Targets=59790&Values=292,218,25746,30072&RawValues=&Redirect=http%3a%2f%2fantivirus.spray.se/">online-scanna</a></div></body></html>