0

Need SQL code to find the following details in a Drive/Path: - Folder Name and File Name - Folder Size and File Size in MB - Date Created and Date Modified and Date Accessed - File Flag (1/0) Yes or no based on whether the line item is a file or a folder - Path/URL/Location of the file or folder Need the details for all the folders and sub-folders and files in a given Path/URL

I have multiple codes which provides each of these details individually, but unable to merge it in a single query or join post execution.

Expected output:

http://s6.postimg.org/cn845zwdd/expected_output.jpg

Parts of the Codes are available in the Blogs as below:

http://sqljourney.wordpress.com/2010/06/08/get-list-of-files-from-a-windows-directory-to-sql-server/#comment-1674 (This link provides a function that gives date modified/path)

Get each file size inside a Folder using SQL (this link provides file size, file flag)

The above links provides parts of the query but i am unable to join them to get them in a single Store procedure..

Community
  • 1
  • 1
  • Its great that you have done some research. Can I suggest that you have a go at creating a unified script yourself and post that as opposed to links pages that partially solve your problem. then we can start from something that is particularly relevant to your problem. – G B Feb 01 '15 at 22:27
  • 1
    Two things: 1) SQL is a special-purpose declarative language used to relate data in a database server. As your link shows, SQL Server would need to connect to a Windows Shell Object to obtain directory file/folder information. Consider using a general-purpose language for this task (i.e, C++, C#, Java, VB, Python, PHP, etc.); 2) SO is not a site to obtain code but a community of experts to lend assistance in debugging and troubleshooting. Please attempt a solution and we can help. – Parfait Feb 01 '15 at 22:30

0 Answers0