While this will work, note that xp_dirtree is undocumented.
You can achieve the same result, if you pipe the result from a simple xp_cmdshell DIR... into a table like so:
create table #temp(
[name] varchar(100))
DECLARE @sql varchar(100)
SET @sql = 'DIR C:\ /b/a-d-s'
INSERT INTO #temp EXEC master.dbo.xp_cmdshell @sql
SELECT COUNT(*) FROM #temp WHERE name LIKE 'abc%'
DROP TABLE #temp
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]