1.

Solve : Listing Original File Creation Dates?

Answer»

Would anyone being willing to help a DOS novice with a problem. I am trying to produce a list of all files on an EXTERNAL storage device based upon the file creation date prior to being copied to the drive. The creation date for most if not all files on the drive is the date that the files were copied to the drive. Is there a field that can be VIEWED, which shows the original creation date for a given file? Additionally, is there a method to using the DIR command to list all files created after or before a given date, that happen to be archived in multiple subdirectories on the drive? Any assistance would be greatly appreciated.

Newbdir /tc tells you the creation date/time

It doesnt look LIKE you can expand the date time in a for loop to give you the creation date.

If you need to use this programmatically, you will need to use the result of a dir in a for loop

There is no way to filter a directory listing based on the date, again you will nee to do this programmatically (date functions in dos are non-existent)

Check out Logparser, this is likely to meet all your needs : http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&DisplayLang=en
GrahamQuote from: Mimaca on October 14, 2007, 05:25:46 PM

Would anyone being willing to help a DOS novice with a problem. I am trying to produce a list of all files on an external storage device based upon the file creation date prior to being copied to the drive. The creation date for most if not all files on the drive is the date that the files were copied to the drive. Is there a field that can be viewed, which shows the original creation date for a given file? Additionally, is there a method to using the DIR command to list all files created after or before a given date, that happen to be archived in multiple subdirectories on the drive? Any assistance would be greatly appreciated.

Newb
problem with DIR is that its not able to show you the date creation till the seconds LEVEL...i have seen how it can be done in pure batch, but its tedious. if you don't mind vbscript...here's one
Code: [Select]On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder="c:\temp" 'you can pass in as script argument too...
Set wshArgs = WScript.Arguments
If wshArgs(0) = "" Or wshArgs(1) = " " Then
WScript.Echo "Usage: cscript /nologo " & Wscript.ScriptName & " "& """MM-DD-YYYY HH-MM-SS""" & " -b(efore)|-a(fter)"
WScript.Quit(1)
End If
dateToCheck = wshArgs(0)
WScript.Echo dateToCheck
b4after = wshArgs(1)

Sub DoWalk(sDir)
Set objFolder = objFSO.GetFolder(sDir)
For Each Files In objFolder.Files
numDays = DateDiff("d", Files.DateCreated , dateToCheck)
If Right(b4after,1) = "a" And numDays < 0 then
WScript.Echo Files, Files.DateCreated
ElseIf Right(b4after,1) = "b" And numDays > 0 Then
WScript.Echo Files, Files.DateCreated
End If
Next
For Each oDir in objFolder.SubFolders
DoWalk oDir.Path
Next
End Sub

DoWalk strFolder
usage: save as myscript.vbs, and on command line, TYPE cscript /nologo myscript.vbs.



Discussion

No Comment Found