alex_toronto27 (2/10/2011)
Jeff, amazing SP !!! , can't figure out how to tweak it to pull all properties for files in sub-folders tooI changed EXEC Master.dbo.xp_DirTree @piFullPath,0,1 - but it's not picking up properties for files in subfolders
Help will be greatly appreciated !
Alex
Using xp_DirTree is a bit of a pain to use for drill downs like you ask for because you have to "smear" each directory name down in a hierarchical fashion.
You could do something like the following and then use BULK INSERT to import the full path names instead of using xp_Dirtree.
DECLARE @ShellRefNum INT
EXEC sp_oaCreate 'wScript.Shell', @ShellRefNum OUT
EXEC sp_oaMethod @ShellRefNum, 'Run', NULL, 'CMD /c "DIR C:\ /s /a-d /b" > c:\Temp\WScriptTest.txt'
EXEC sp_oaDestroy @ShellRefNum
As Sergiy suggested earlier, you could also just use DIR /s for the command and do the necessary parsing.
--Jeff Moden
Change is inevitable... Change for the better is not.