Microsoft Interview Question

Write a function to list all documents under your C: drive.

Interview Answer

Anonymous

Mar 16, 2010

create a recursive function that would return the list of documents from a folder.. It'd go something like (ya sorry for the bad coding standard here) function ListofDocuments SearchFolder(folder name) var tempDocuments = new ListofDocuments(); For each folder in current folder tempDocuments =+ SearchFolder(thisFolder) Loop tempDocuments += get documents from current folder return tempDocuments End Now run: print SearchFolder("C:\")