cannot get DateDiff of date deleted and Now() in vbscript <p>I am trying to create a vbscript that automatically clears files/folders from the recycle bin that have been there for more than x days. the problem is, when I get the deletion date of the files, the DateDiff function returns a mismatch error.</p> <pre><code> const Active = TRUE const MaxAge = 30 const RECYCLE_BIN = &amp;Ha&amp; checked = 0 deleted = 0 Set objFso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(RECYCLE_BIN) Set colItems = objFolder.Items For Each objItem In colItems Checked = Checked + 1 dateDeleted = objFolder.GetDetailsOf(objItem, 2) 'the deletion date per file/folder If DateDiff("D", dateDeleted, Now()) &gt; MaxAge Then If objItem.Type = "File Folder" Then Deleted = Deleted + 1 objFso.DeleteFolder(objItem.Path) Else Deleted = Deleted + 1 objFso.DeleteFile(objItem.Path) End If End If Next if Active then verb = " file(s) deleted" Else verb = " file(s) would be deleted" WScript.Echo Checked &amp; " file(s) checked, " &amp; Deleted &amp; verb </code></pre> <p>I have also tried doing this but this also returned to mismatch error:</p> <pre><code> const Active = TRUE const MaxAge = 30 const RECYCLE_BIN = &amp;Ha&amp; checked = 0 deleted = 0 Set objFso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(RECYCLE_BIN) Set colItems = objFolder.Items For Each objItem In colItems Checked = Checked + 1 dateStr = objFolder.GetDetailsOf(objItem, 2) 'the deletion date per file/folder dateArr = Split(dateStr, " ") If DateDiff("D", dateArr(0), Now()) &gt; MaxAge Then If objItem.Type = "File Folder" Then Deleted = Deleted + 1 objFso.DeleteFolder(objItem.Path) Else Deleted = Deleted + 1 objFso.DeleteFile(objItem.Path) End If End If Next if Active then verb = " file(s) deleted" Else verb = " file(s) would be deleted" WScript.Echo Checked &amp; " file(s) checked, " &amp; Deleted &amp; verb </code></pre> <p>AND tried: const Active = TRUE const MaxAge = 30 const RECYCLE_BIN = &amp;Ha&amp;</p> <pre><code> checked = 0 deleted = 0 Set objFso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(RECYCLE_BIN) Set colItems = objFolder.Items For Each objItem In colItems Checked = Checked + 1 dateStr = objFolder.GetDetailsOf(objItem, 2) 'the deletion date per file/folder dateArr = Split(dateStr, " ") dateDeleted = cDate(dateArr(0)) If DateDiff("D", dateDeleted, Now()) &gt; MaxAge Then If objItem.Type = "File Folder" Then Deleted = Deleted + 1 objFso.DeleteFolder(objItem.Path) Else Deleted = Deleted + 1 objFso.DeleteFile(objItem.Path) End If End If Next if Active then verb = " file(s) deleted" Else verb = " file(s) would be deleted" WScript.Echo Checked &amp; " file(s) checked, " &amp; Deleted &amp; verb </code></pre> <p>but again this does not work and creates a mismatch error on the cDate.</p> <p>any help would be appreciated</p>