Undocumented Extended Stored Procedures – XPs
xp_fixeddrives is a useful extended stored procedure which returns amount of free space available in MB, for all local hard drives.
– © 2011 – Vishal (http://SqlAndMe.com)
EXEC master..xp_fixeddrives
drive MB free
—– ———–
C 91884
S 538
(2 row(s) affected)
It can be only used to check for free space on local drives, it won’t check mapped drives.
Another useful extended stored procedure is xp_fileexist, which can be used to check the existence of a file on file system.
– © 2011 – Vishal (http://SqlAndMe.com)
EXEC master..xp_fileexist 'C:\Windows\Explorer.exe'
File Exists File is a Directory Parent Directory Exists
———– ——————- ———————–
1 0 1
(1 row(s) affected)
xp_fileexist can also be used to check existence of a directory:
– © 2011 – Vishal (http://SqlAndMe.com)
EXEC master..xp_fileexist 'C:\Windows\System32'
File Exists File is a Directory Parent Directory Exists
———– ——————- ———————–
0 1 1
(1 row(s) affected)
It also checks if the Parent Directory exists.
Hope This Helps!
Vishal
If you like this post, do like my Facebook Page -> SqlAndMe
EMail me your questions -> Vishal@SqlAndMe.com
Follow me on Twitter -> @SqlAndMe
-
August 1, 2011 at 9:04 pm | #1SQL Server – New OS Related DMF – sys.dm_os_volume_stats « Sql&Me
-
October 3, 2011 at 3:00 pm | #2SQL Server – New OS Related DMF – sys.dm_os_volume_stats – Vishal Gajjar's Blog

