February 06, 2008

Tips3 - To get all sub folders

This code snippet will be helpful to get all sub folders.

CODE:
[ ]
[+] LIST OF STRING GetDirectories (STRING sDirPath)
[ ]
[ ] LIST OF FILEINFO lfFiles
[ ] FILEINFO file
[ ] LIST OF STRING lsDirsFound = {...}
[ ]
[ ]
[-] if ! SYS_DirExists ( sDirPath )
[ ] LogWarning ( "Cannot find '{sDirPath}' on file system" )
[ ]
[ ] lfFiles = SYS_GetDirContents (sDirPath)
[ ]
[-] for each file in lfFiles
[-] if (file.bIsDir)
[ ] ListAppend (lsDirsFound, sDirPath + "\" + file.sName)
[ ]
[ ] ListSort (lsDirsFound)
[ ]
[ ] return lsDirsFound

0 comments: