Yes, I have done that. I generally make a temp table, then execute something like
SET @listCom = 'DIR /b ' + @yourFolderName + '*.foo'
INSERT INTO #dirlist ( fname ) EXEC master..XP_CMDSHELL @listCom
Then you can query the table. Beware that the result set might just be "File Not Found"