Obviously the command forfiles doesn't have a clue to filter files by Created Date.īelow is a few results from the query given above in which FileNames are prefixed by Modified Date. Insert file list from directory to SQL ServerĭECLARE varchar(1024) = 'z: & forfiles /m *.jpg /s /d /c "cmd /c echo INTO myFilesTableĮXEC _cmdshell Check the list Create the table to store file listĬREATE TABLE myFilesTable (myFileID INT IDENTITY, myFileName NVARCHAR(256)) The query below only works with Modified Date when executing xp_cmdshell. I want to know if there's a way to load files according to Created Date instead of Modified Date in Windows command prompt. In SQL Server, I am using a query below to load all ".jpg" file names from a specific directory (e.g.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |