`
Clarion in general: Getting subfolders into a queue 2004-04-03 -- Bjarne Havnen Newsgroups: comp.lang.clarion Below is some code I was forced to write because XP couldn't find a particular file for me. This procedure calls itself recursively from a starting directory. This will not compile as is, since I also use a few global variables to set if I should include subfolders. It should be a good start. Consentrate on the Dirq part for your problem SearchFiles PROCEDURE (*File:Queue q,string searchpath,string txt) ! Declare Procedure ! Start of "Data Section" ! [Priority 5000] DirQ Queue(File:Queue),Pre(Dirq) End Scan Cstring(50) SearchFor Cstring(255) ! End of "Data Section" CODE ! Begin processed code ! Start of "Processed Code" ! [Priority 5000] If Sub(Searchpath,Len(Clip(SearchPath)),1)='\' !slash SearchPath = Sub(SearchPath,1,Len(Clip(SearchPath))-1) End If IncludeSubFolders SearchFor = Clip(SearchPath)&'\*.*'!*.tpw' Directory(Dirq,SearchFor,ff_:Directory) End r#=Records(Q) !number of records If Not FileTypes FileTypes = '*.*' End LastPos#=1 Loop Pos#=Instring(',',FileTypes,1,LastPos#+1) If Not Pos# Pos#=Len(FileTypes)+1 Do SearchDirectory Break Else Do SearchDirectory LastPos#=Pos#+1 End End Loop I#=Records(Q) To R# By -1 Get(Q,I#) If Not Instring('\',q.Name) !ikke no Directory() Q.Name = Clip(Searchpath)&'\'&Q.Name Q.Name = LongPath(Q.Name) Put(q) End If FromDate If Q.Date Printed November 21, 2024, 6:59 am This article has been viewed/printed 35221 times. Google search has resulted in 12 hits on this article since January 25, 2004. |