This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
I am working on project where I needed to programmatically enumerate the list of documents stored in the SharePoint Document Library. As it quite often turns out this task is fairly trivial once you figure out the right approach. Let me provide a quick walk-through on how I accomplished this task.
Background
SharePoint provides various Web Services that allow a developer to extract all sorts of information regarding SharePoint. On of such Web Services is Site Data Service, and one of the methods of this Web Service is EnumerateFolder. Once you know this the reset is easy.
See this walkthrough for details