>Execute master..xp_subdirs N'C:\ImpactMD\Images' >>
SET NOCOUNT ON --Capture SP results into temp.table CREATE TABLE #Temp1 (subdirectory NVARCHAR(1000)) INSERT INTO #Temp1 Execute master..xp_subdirs N'C:\TEMP' --Create Cursor, so you can loop through it... DECLARE @Subdir NVARCHAR(1000) DECLARE crsTemp CURSOR LOCAL FAST_FORWARD READ_ONLY FOR SELECT * FROM #Temp1 OPEN crsTemp --here comes the loop FETCH NEXT FROM crsTemp INTO @Subdir WHILE (@@FETCH_STATUS = 0) BEGIN PRINT @Subdir FETCH NEXT FROM crsTemp INTO @Subdir END --cleanup CLOSE crsTemp DEALLOCATE crsTemp if object_id('tempdb..#Temp1') is not null drop table #Temp1Cheers,