Skip to content

Instantly share code, notes, and snippets.

@leomao10
Created November 1, 2010 06:55
Show Gist options
  • Save leomao10/657740 to your computer and use it in GitHub Desktop.
Save leomao10/657740 to your computer and use it in GitHub Desktop.
Accessing the Windows File System from SQL Server
--Extended Stored Procedure - xp_cmdshell - Ability to execute any DOS command line code.
EXEC master.dbo.xp_cmdshell 'dir c:\'
GO
--Extended Stored Procedure - xp_fixeddrives - Ability to capture the free drive space in megabytes.
EXEC master.dbo.xp_fixeddrives
GO
--Extended Stored Procedure - xp_subdirs - Ability to capture the sub directories, but not files
EXEC master.dbo.xp_subdirs 'c:\'
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment