how to get the date of a file using xp_cmdshell?
3
votes
2
answers
9766
views
So far I've this code
CREATE TABLE #tmp (strData VARCHAR(1000))
INSERT INTO #tmp EXEC xp_cmdshell 'dir C:\Users\Giba\Desktop\Folder\cmdshell1\*.txt'
SELECT * FROM #tmp --WHERE strData LIKE '09/25/2018'
DROP TABLE #tmp
but I want to select only date of the .txt files and compare them with current date. Can someone help to select only the date?

Asked by Eola Giba
(43 rep)
Sep 24, 2018, 09:47 PM
Last activity: Apr 17, 2025, 06:04 PM
Last activity: Apr 17, 2025, 06:04 PM