Get Directory Structure using Extended Stored Procedure xp_dirtree

Exec xp_dirtree 'C:\Windows'
Execution of the above stored procedure will give following result. If you prefer you can insert the data in the temptable and use the same for further use.
Here is the quick script which will insert the data into the temptable and retrieve from the same.
CREATE TABLE #TempTable (Subdirectory VARCHAR(512), Depth INT);INSERT INTO #TempTable (Subdirectory, Depth)EXEC xp_dirtree 'C:\Windows'SELECT SubdirectoryDepthFROM #TempTable;DROP TABLE #TempTable;

Comments

Popular posts from this blog

SSIS vs. T-SQL

Sync SSAS Cube From One Environment to Another

Pump data from one server to another Efficiently