It appears that the filedate command is returning the modified date of the file. (Version 6.2.3vb). Is there a way to have it return the create date? I am wanting to delete any files or directories in a folder based on create date. If a person copies an older presentation to the folder it appears to keep the modified date, set's the create date to the date written.
Thanks,
-dm
Can Filedate return the create date not the modified date?
Moderators: JRL, Dorian (MJT support)
Even my limited mind can recognize the diversity, quality, and usefulness of this compilation. From a reader..."All hand-crafted assembler, tiny and incredibly fast. More than a power-users batch toolkit. There is something here for everybody. How can anyone manage without it?" With excellent, separate documentation for each program. Author: Horst Schaeffer, Germany. (2002). Suggested by Robert Bull.
Homepage
Maybe the date tools (isdate) do what you want to accomplish ...
Homepage
Maybe the date tools (isdate) do what you want to accomplish ...
Hi,
Why not use the FileSystemObject's DateCreated property. Here's a function you can use:
VBSTART
Function GetCreateDate(file)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(file)
GetCreateDate = f.DateCreated
Set fso = Nothing
Set f = Nothing
End Function
VBEND
VBEval>GetCreateDate("c:\program files\somedir\myfile.txt"),cdate
MessageModal>cdate
Why not use the FileSystemObject's DateCreated property. Here's a function you can use:
VBSTART
Function GetCreateDate(file)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(file)
GetCreateDate = f.DateCreated
Set fso = Nothing
Set f = Nothing
End Function
VBEND
VBEval>GetCreateDate("c:\program files\somedir\myfile.txt"),cdate
MessageModal>cdate
MJT Net Support
[email protected]
[email protected]
Taking this further here's a function which will delete files in a specified folder that were created before the specified date:
VBSTART
Function DelCreatedBefore(folderspec,createdate)
Dim fso, f, f1, fc
lastfiledate = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
If f1.DateCreated DelCreatedBefore("c:\program files\mydir",now()),return
VBSTART
Function DelCreatedBefore(folderspec,createdate)
Dim fso, f, f1, fc
lastfiledate = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
If f1.DateCreated DelCreatedBefore("c:\program files\mydir",now()),return
MJT Net Support
[email protected]
[email protected]
Wow, that is some support!
I can use VBScript and that get's me started down the right path. I will actually need to set the directory, and delete any files older than x days old in that directory and any subdirectories. If the subdirectory is then empty it needs to be deleted.
Am I getting greedy now or what!
I had looked at the script for finding the last modified file in a dir. When I try and run it, compilation error 1002, line 22, column 6.
I will try the one given for this and check it out.
Thanks,
-dm
I can use VBScript and that get's me started down the right path. I will actually need to set the directory, and delete any files older than x days old in that directory and any subdirectories. If the subdirectory is then empty it needs to be deleted.
Am I getting greedy now or what!
I had looked at the script for finding the last modified file in a dir. When I try and run it, compilation error 1002, line 22, column 6.
I will try the one given for this and check it out.
Thanks,
-dm