Can someone tell me how to add a breadcrumb for a document library to a site page so that it will show the nested folder structure as a user navigate up and down the directory structure.
Document Library > Folder1 > Folder2
By default there are no OOTB functionality that brings breadcrumb for a document library.
To get the nested folder structure of the Document Library, you will have to decode the URL of your site, when you click on each folder. There is an
You need to add this into a webpart, edit the document library and add the webpart above the document library to view as a bread crumb.
UPDATE: Finally I've created a project on CodePlex: http://fullpathbreadcrumb.codeplex.com. It implements the functionality described in this post.
Although there's a "Best answer" marked answer already I've shared my custom webpart code for the same task - it modifies library breadcrumb and add a full folder path to it:
And the result (http://gyazo.com/981e78fb2266b0cd27221545c65a44cd.png):
As for your question where to put the code - you need to create SharePoint 2010 project and add new project item of WebPart type (note - you don't need a visual web part for this task as you don't need the UI at all):