Something like this, perhaps?CREATE TABLE #Files ( Information VARCHAR(300) )INSERT #Files ( Information )EXEC master..xp_cmdshell 'dir /4 /-c /tw %windir%\*.*'DELETEFROM #FilesWHERE LEFT(Information, 1) = ' ' OR Information IS NULL OR SUBSTRING(Information, 22,5) = '<DIR>'INSERT MyTable ( FileName, FileSize, FileWritten )SELECT SUBSTRING(Information, 37, 80) FileName, CONVERT(INT, SUBSTRING(Information, 26, 10)) FileSize, CONVERT(DATETIME, LEFT(Information, 17)) FileWrittenFROM #FilesDROP TABLE #Files
Peter LarssonHelsingborg, Sweden