Calculating file size of a folder

Posted on 2009-12-23
Last Modified: 2012-05-08

Is it possible to calculate total file size of a folder in the file system using SQL query?

I have a table that contain folder path in one of the column.

SELECT FolderPath FROM MyData

This will give result like:


I need to count the file size in each Folder Path.

Is this possible?

System is Windows 2003 server with MS SQL 2005.

Question by:klompen
    LVL 75

    Accepted Solution

    i wonder there is no straight forward methods
    LVL 41

    Assisted Solution

    As indicated by Aneesh, it's cumbersome.
    You could write a program in DOS and then create a temporary table with the values. Check this link as a starting point:

    Author Comment

    Thanks for all your answers. I thought that as well.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
    In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now