I've used variations on this in the past, with the insert into #temp exec xp_cmdshell 'dir'
I tried to wrap this in a stored procedure, to be used by other procedures, but then I got the dreaded
[font="Courier New"]An INSERT EXEC statement cannot be nested.[/font]
Suggestions on how to use the results of the procedure in my own temp table?