Here is a code by which you can enlist all files and folder in a particualr folder/directory recursively in php, and store it as tree structure in database.