Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Could not figure out exactly what this code does
Message
 
 
À
03/06/2009 12:38:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01403230
Message ID:
01403441
Vues:
46
You're right, sorry. It is just case-sensitive, I need case insensitive.

I can make this change myself, though, it's not a problem.

>Don't see the problem
>
>
>SubFolders(@m.QueueObj, CURDIR(),  '*\Images\I*') 
>
>
>
>>Unfortunately, the directory to exclude is like 'Images\I*'
>>
>>FUNCTION RecursiveDirectoryList
>>* Gregory Adam
>>
>>#define TRUE	.t.
>>#define FALSE	.f.
>>*-------------------------------------------------------------------------------
>>local QueueObj, SubfolderName
>>
>>
>>if( SubFolders(@m.QueueObj, CURDIR(), '*reports\_*') )
>>
>>	do while m.QueueObj.DeQueue(@m.SubfolderName)
>>		?SubfolderName
>>	enddo
>>endif
>>*-------------------------------------------------------------------------------
>>function SubFolders(QueueObj, FolderName, FileSkeletonExclude)
>>
>>	local Success
>>	Success = TRUE
>>	
>>	local StackObj, ColObj, SubfolderName
>>	StackObj = createObject('Stack')
>>	QueueObj = createobject('Queue')
>>	ColObj = createObject('Queue')
>>	
>>	local fsObj
>>	fsObj = createobject('Scripting.FileSystemObject')
>>	
>>	do case
>>	case !m.Success
>>	
>>	otherwise
>>		try
>>			objSubFolders = m.fsObj.GetFolder(m.FolderName).SubFolders
>>		
>>		catch
>>			assert FALSE
>>			Success = FALSE
>>		
>>		endtry
>>	
>>	endcase
>>	
>>	
>>	do case
>>	case !m.Success
>>	
>>	otherwise
>>		for each Subfolder in m.objSubFolders 
>>			=m.ColObj.EnQueue(m.Subfolder.Path)
>>		endfor
>>		
>>	endcase
>>
>>	do while m.Success ;
>>			and m.StackObj.AppendFrom(m.ColObj, TRUE) ;
>>			and m.ColObj.Clear() ;
>>			and m.StackObj.Pop(@m.SubfolderName)
>>		
>>		if( !empty(m.FileSkeletonExclude) and like(m.FileSkeletonExclude, m.SubfolderName) )
>>			loop
>>		endif
>>		
>>		=m.QueueObj.EnQueue(m.SubfolderName)
>>		
>>		objSubFolders = m.fsObj.GetFolder(m.SubfolderName).SubFolders
>>		
>>		for each Subfolder in m.objSubFolders 
>>			=m.ColObj.EnQueue(m.Subfolder.Path)
>>		endfor
>>		
>>	
>>	enddo
>>	
>>	
>>	return m.Success
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>*-------------------------------------------------------------------------------
>>*===============================================================================
>>*===============================================================================
>>*===============================================================================
>>define class Stack as CollectionBase
>>
>>*-------------------------------------------------------------------------------
>>function Push(v)
>>	=m.this.Add(m.v)
>>endfunc
>>*-------------------------------------------------------------------------------
>>function Pop(v)
>>	
>>	if( empty(m.this.Count) )
>>		return FALSE
>>	endif
>>	v = m.this.Item(m.this.Count)
>>	=m.this.Remove(m.this.Count)
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>function Peek(v)
>>	
>>	if( empty(m.this.Count) )
>>		return FALSE
>>	endif
>>	v = m.this.Item(m.this.Count)
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>*-------------------------------------------------------------------------------
>>enddefine
>>*===============================================================================
>>*===============================================================================
>>*===============================================================================
>>
>>
>>*===============================================================================
>>*===============================================================================
>>*===============================================================================
>>define class Queue as CollectionBase
>>
>>*-------------------------------------------------------------------------------
>>function EnQueue(v)
>>	=m.this.Add(m.v)
>>endfunc
>>*-------------------------------------------------------------------------------
>>function DeQueue(v)
>>	
>>	if( empty(m.this.Count) )
>>		return FALSE
>>	endif
>>	v = m.this.Item(1)
>>	=m.this.Remove(1)
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>function Peek(v)
>>	
>>	if( empty(m.this.Count) )
>>		return FALSE
>>	endif
>>	v = m.this.Item(1)
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>enddefine
>>*===============================================================================
>>*===============================================================================
>>*===============================================================================
>>
>>*===============================================================================
>>*===============================================================================
>>*===============================================================================
>>define class CollectionBase as Collection
>>
>>*-------------------------------------------------------------------------------
>>function Clear()
>>	
>>	=m.this.Remove(-1)
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>function Empty()
>>
>>	return empty(m.this.Count)
>>	
>>endfunc
>>*-------------------------------------------------------------------------------
>>function AppendFrom(ColObj, Reversed)
>>	
>>	local i
>>	
>>	do case
>>	case !m.Reversed
>>		for i = 1 to m.ColObj.Count
>>			=m.this.Add(m.ColObj.Item[m.i])
>>		endfor
>>	
>>	otherwise
>>		for i = m.ColObj.Count to 1 step -1
>>			=m.this.Add(m.ColObj.Item[m.i])
>>		endfor
>>	
>>	
>>	endcase
>>	
>>
>>endfunc
>>*-------------------------------------------------------------------------------
>>enddefine
>>
>>
>>>Easy it is
>>>(1) add an optional parameter
>>>(2) Skip the like(parameter)
>>>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform