Gerrit Mantel
Programs SQL_SCALAR_FUNCTION - fun_FolderProperty_Size

Main program

Namefun_FolderProperty_Size
Type_descSQL_SCALAR_FUNCTION
CommentSQLServer User-Defined Function

PURPOSE
Return the size (in bytes) of a given directory.

The size is including it's subdirectories.

Return value (BIGINT):
-1 - Directory does not exist
positive big integer - Size of the directory in bytes

EXAMPLE
SELECT dbo.fun_FolderProperty_Size('C:\inetpub')
386534770

SELECT dbo.fun_FolderProperty_Size('C:\xxx')
-1

HISTORY
2000-01-01 - Created function
2014-11-20 - Changed @size type from varchar(20) to bigint
- Introduced sp_OADestroy @ofolder
2024-02-09 - Changed history table

TAGS
<program>
<description>Return the size (in bytes) of a given directory</description>
<generic>1</generic>
<author>Gerrit Mantel</author>
<created>2000-01-01</created>
<lastmodified>2024-02-09</lastmodified>
</program>
DescriptionReturn the size (in bytes) of a given directory
Minversion
Generic1
AuthorGerrit Mantel
Created2000-01-01 00:00:00
Lastmodified2024-02-09 00:00:00
Xp_cmdshell0
Ole_automation1
Subprogram_cnt0
Sourcecode