Hi,
Folders like "c:\users", "c:\windows", "c:\program files" are all being skipped in Windows 7/8 when running this code... I can traverse those folders in Windows explorer without issue...
Any idea what I can change?
Thanks,
Stanley
Folders like "c:\users", "c:\windows", "c:\program files" are all being skipped in Windows 7/8 when running this code... I can traverse those folders in Windows explorer without issue...
Any idea what I can change?
Thanks,
Stanley
Code:
pcStartFolder = 'C:\'
lcPath = ''
Public gcExt, gcStartFolder, gcType, gcTypeName
gcStartFolder = pcStartFolder
gcTypeName = ''
Create Cursor FileList (file_name c(64), full_path c(254), file_type c(1), file_ext c(20), file_size I, type_name c(40))
If Empty(lcPath)
lcPath = gcStartFolder
Endif
*-- Call the recursive routine to walk the tree...
Do treewalk With lcPath
Wait Clear
**************************************************************************************
Procedure treewalk
Parameters lcPath
Private All Like l*
Do Case
Case Adir(laFileList,lcPath+"*.MP3") <> 0 &&MP3
gcType="M"
gcTypeName = 'MP3 Audio'
gcExt="MP3"
=storeit(@laFileList,lcPath)
Endcase
* Determines whether there are any subdirectories.
lnDirCount = Adir(laSubDirs, lcPath + "*.*", "D")
If lnDirCount > 0
For lnCount = 1 To lnDirCount
If (laSubDirs[lnCount, 5] = ".H..D" .or. laSubDirs[lnCount, 5] = "....D") .And. Left(laSubDirs[lnCount, 1], 1) # "."
* If so, traverse them...
Do treewalk With lcPath + laSubDirs[lnCount, 1] + "\"
Endif
Next
Endif
Endproc
**************************************************************************************
*-- Store values into FileList.
Procedure storeit
Parameters laFileList, lcPath
Local lcBarePath, lcDrive
lcDrive = Left(lcPath, 1)
lcBarePath = Substr(lcPath, 3, 158)
Wait Window Nowait "Processing Folder: " + lcPath
If Type("laFileList[1]") #"U" And !Empty(laFileList[1])
For lnCount = 1 To Alen(laFileList, 1)
gcExt = Justext(Alltrim(lcDrive) + ":" + lcBarePath + Alltrim(laFileList[lnCount, 1]))
Wait Alltrim(lcDrive)+":"+lcBarePath+Alltrim(laFileList[lnCount,1]) Window Nowait
Insert Into FileList (file_name, full_path, file_type, file_ext, file_size, type_name) ;
VALUES (;
laFileList[lnCount, 1], ;
alltrim(lcDrive) + ":" + lcBarePath + Alltrim(laFileList[lnCount, 1]), ;
gcType, ;
gcExt, ;
laFileList[lnCount, 2], ;
gcTypeName)
Next
Endif
Endproc