Is there any other way to get a list of file names via T-SQL
other than
INSERT INTO @backups(filename)
EXEC master.sys.xp_cmdshell \'DIR /b c:\\som
Three options, depending on your environment and needs:
RESTORE FILELISTONLY disk='FULL_PATH_TO_YOUR_FILE'
. This throws a non-fatal error if the file doesn't exist. You can check for an error in T-SQL by testing if @@error is non-zero.