Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Namespace is not returning a true directory name
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01235257
Message ID:
01235684
Vues:
19
I was able to get passed the 'My xxxx' issue. Now can someone tell me how to get hidden files and folders to be included in loShell.Namespace( lcDir ).
CLEAR

lcDir = [C:\Documents and Settings\Administrator\]

loShell = CreateObject("Shell.Application")
loFolder = loShell.Namespace( lcDir )

For Each lcFileName in loFolder.Items
	*--------------------------------------------------    
	*-- get alternate name
	*--------------------------------------------------       
	lcAltName 	= loFolder.GetDetailsOf(lcFileName, 0)	
	lcAltName 	= STRTRAN(lcAltName,'Shared Documents',	'Documents')
	
	lcAltName 	= STRTRAN(lcAltName,'Shared Music',		'My Music')
	lcAltName 	= STRTRAN(lcAltName,'Shared Pictures',	'My Pictures')
	lcAltName 	= STRTRAN(lcAltName,'Shared Video',		'My Videos')		
		
	lnBegPos 	= AT(['s],lcAltName)		
	IF lnBegPos > 0 AND INLIST( ALLTRIM(SUBSTR(lcAltName,lnBegPos + 3, 254)),'Documents','Music','Pictures','Videos')
		lcAltName = ALLTRIM( 'My ' + SUBSTR(lcAltName,lnBegPos + 3, 254))
	ENDIF 		
	*-------------------------------------------------- 	
	
	lcFullPath 	= lcDir + lcAltName
	 
	if !directory(lcFullPath,1) 
		?'Dir not found: ' + lcFullPath
*!*			FOR t= 0 TO 34
*!*			      ? "File name "+STR(t,2)+": "+ loFolder.GetDetailsOf(lcFileName, t)
*!*			next		
	ELSE
		?'        found: ' + lcFullPath	
	ENDIF 
	
NEXT 	   
>my bad, here is the correct sample
>
>CLEAR
>
>lcDir = [C:\Documents and Settings\Administrator\]
>
>loShell = CreateObject("Shell.Application")
>loFolder = loShell.Namespace( lcDir )
>
>For Each lcFileName in loFolder.Items
>
>	lcName 		= loFolder.GetDetailsOf(lcFileName, 0)
>	lcFullPath 	= lcDir + lcName
>	
>	if !directory(lcFullPath)
>		?'Dir not found: ' + lcFullPath
>	ELSE
>		?'        found: ' + lcFullPath	
>	ENDIF
>	
>NEXT
>
>>Mike,
>>
>>lcDirName is the name of the folder returned, not the full path
>>See below
>>
>>>Namespace is not returning a true directory name. How do I get around this?
>>>
>>>
>>>CLEAR
>>>
>>>lcDir = [C:\Documents and Settings\Administrator\My Documents\]
>>>
>>>loShell = CreateObject("Shell.Application")
>>>loFolder = loShell.Namespace( lcDir )
>>>
>>>For Each lcFileName in loFolder.Items
>>>	lcDirName = loFolder.GetDetailsOf(lcFileName, 0)
>>         lcDirName = addbs(lcDir ) + loFolder.GetDetailsOf(lcFileName, 0)
>>>	if !directory(lcDirName)
>>>		?'Dir not found: ' + lcDirName
>>>	ENDIF
>>>NEXT 	
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform