Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Wildcard Matches for Directories
Message
 
À
21/02/2005 14:30:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows '98
Network:
Novell 6.x
Database:
Visual FoxPro
Divers
Thread ID:
00988969
Message ID:
00988981
Vues:
18
>Is there a function out there that will perform similar to the sys(2000) function, but instead of rolling through files, one that will work with wildcard matches on folders? Basically, I have a folder with a bunch of folders within that with the first word as a username from my program, but it also has additional information in the folder's name following the username, but it seperated by a space. I want to be able to access that folder based on whom is logged in and use that username to go into that folder. Any ideas?


You can loop trhu the subfolders and compare the name, something like:
local loFolder

loFolder	= FindFolder('C:\MyRootFolder', 'MyUser')

Function FindFolder(tcRootFolder, tcFolderName)
local loWSH, loFolder, loRootFolder

loWSH		= Createobject('Scripting.FileSystemObject')
loRootFolder	= loWSH.GetFolder(tcRootFolder)
for each loFolder in loRootFolder.SubFolders
	if tcFolderName = loFolder.Name && With exact off
		&& Folder found
		return loFolder
	endif
endfor
* Assuming all user folders are in the same level, you might need to change this if the users can be found in subfolders of the root folder
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform