` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Clarion in general: Remove directory and all subdirectories
2004-06-23 -- Sean Cameron (capesoft)
 
Newsgroups: comp.lang.clarion That doesn't seem like a very "elegant" solution I'd write a quick recursive DeleteDirectory() function: DeleteDirectory(string fullPath) curPath string(File:MaxFileName) dirQ queue(File:Queue), pre(dirQ) end i long Directory(dirQ, Clip(fullPath) & '\*.*', ff_:Directory) ! get all files and directories loop i = 1 to Records(dirQueue) if Band(dirQ.Attrib, ff_:Directory) and dirQ.ShortName <> '..' and DirQ.ShortName <> '.' ! it is a directory so recurse DeleteDirectory(Clip(fullPath) & '\' & Clip(dirQ.name)) ! recurse else Remove(Clip(fullPath) & '\' & Clip(dirQ.name)) ! delete the file end end RemoveDirectory(fullPath) ! delete the now empty directory Should work fine and only a minute or two's work (excuse any bug, it is off the top of my head!) and you don't have to have a flashing DOS window or have it break when the next version of windows doesn't support your command . Exactly the same method can be used to trivially construct DirectoryCopy() and DirectoryMove() functions. Note that I have called the RemoveDirectory() API, but you could also use the RemoveDirectory() function in CWutil. -- Regards, Sean Cameron CapeSoft www.capesoft.com


Today is November 23, 2024, 3:26 am
This article has been viewed 35262 times.
Google search has resulted in 282 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: