

The XML documents and make two types of comparison on those. It will fetch all the values from the nodes of both First copy all the files found mismatched on modified date into NEXT FROM INTO "' +'\'+ '" "' + + '"'ĮXEC xp_cmdshell NEXT FROM INTO CompareXML stored procedure above will first call the ‘MakeXML' sp and get Fetch all the extra files in the source folder

SELECT N.value('ModifiedDate','varchar(100)') AS MDATE ,

Join both the tables retrieved from xml on filename and get all the files having modifieddate mismatch Call the MakeXML sp to return the XML for Source and Destination Folders Make an xml out of separated ModifiedDate,FileName columns and SET the OUTPUT parameterįor our example the stored procedure would return XML for the Source folder ordered UPDATE SET FileName=SUBSTRING(fullpath,40,LEN(fullpath)) UPDATE SET ModifiedDate=SUBSTRING(fullpath,1,PATINDEX('%M%',fullpath)+1) Separate the modified date from the fullpath txt or can specify the file type you want to compare on use xp_cmdshell stored procedure to run dos commandsĮXECUTE xp_cmdshell all the files that are other than. run dir command on the path specified by ordering on the date modified To update the currently configured value for this feature. To update the currently configured value for advanced options. To allow advanced options to be changed.ĮXEC sp_configure 'show advanced options', 1 INPUT THE FILEPATH FOLDER AND IT WILL RETURN AN XMLĭECLARE TABLE (MyID INT IDENTITY(1,1) PRIMARY KEY,FullPath VARCHAR(2000),ModifiedDate datetime, FileName VARCHAR(100))
