|
|
I'm using VFP9 and trying to get a list of files / folders of a given directory. The sample code below works great but is missing hidden files and filders such as 'Local Settings'. Can you help?
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
-- Mike Azar
Message posted via WinServerKB.com http://www.winserverkb.com/Uwe/Forums.aspx/windows-server-scripting/200706/1
|
|
|