` 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  

Par2: Recursively add/delete directories
2000-12-18 -- James Cooke
 
Try this function to recursively create an entire subdir structure. I wrote this yonks ago and has some legacy stuff in it but it works ok. It is called like this: Makepath('c:\dir1\dir2\dir3\xyz.txt') !Inside the global Map: MODULE('WINAPI') !!Prototype to play sound (requires equate for LPCSTR data type in After Global includes) OMIT('***',_WIDTH32_) fn_split(*CString,*CString,*CString,*CString,*CString),short,raw,name('_fnsplit') MkDir(*CSTRING),SHORT,RAW,NAME('_mkdir') End *** COMPILE('***',_WIDTH32_) fn_split(*CString,*CString,*CString,*CString,*CString),short,raw,name('_fnsplit') MkDir(*CSTRING),SHORT,RAW,NAME('_mkdir') *** END !Function Variables: MakePath FUNCTION (FullFileName) ! Declare Procedure ThePath CSTRING(255) TheDrive CSTRING(255) TheDir CSTRING(255) TheName CSTRING(255) TheExt CSTRING(255) BuildString STRING(50) FullDirectoryName CSTRING(255) !Function Code: MEMBER('programs.clw') ! This is a MEMBER module MakePath FUNCTION (FullFileName) ! Declare Procedure CODE ! Begin processed code z#=0 ThePath = FullFileName If Fn_Split(ThePath,TheDrive,TheDir,TheName,TheExt). clear(FullDirectoryName) loop i#=1 to len(clip(TheDir)) If TheDir[i#]='\' BuildString=clip(BuildString)&'\' FullDirectoryName = left(BuildString) clear(FullDirectoryName[len(clip(FullDirectoryName))]) If FullDirectoryName FullDirectoryName = TheDrive&FullDirectoryName Z#+=MkDir(FullDirectoryName) end else BuildString[i#]=TheDir[i#] end end If z#<0 then return(0) else return(1).


Today is May 4, 2024, 9:51 pm
This article has been viewed 35119 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: