Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Modified, Created properties

Status
Not open for further replies.

richardii

Programmer
Jan 8, 2001
104
GB
Is there any VBscript to do a bulk change of the Modified/Created/Accessed date properties of a certain file type? There are 1000s of htm files we need to all set to a certain date.

Thanks.
 
There won't be a "mass" solution for your problem, but a

for each next

loop with a fileSystemObject should work just fine for you, just looping through each and every file in a particular directory.

for more info on the fileSystemObject... go to vbScript, and then 'view index' from the title of the page.

:)
Paul Prewett
penny.gif
penny.gif
 
Thanks, but I can't see how you set the modified/created dates. I have found a file utility called AFile Attribute Manager that will do this, but I'm still interested to know if it's possible in vbscript.
 
Here some example

Code:
   Dim fso, file
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set file = fso.GetFile(filespec)
   DateCreated = file.DateCreated
   DateLastAccessed = file.DateLastAccessed
   DateLastModified =file.DateLastModified
________
George, M
 
I have this script. However it doesn't like the property DateCreated. I want to actaually set the date to 14/02/1987, something I can specify. Thanks.

Dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile("c:\somefile.txt", True)
path = filesys.GetAbsolutePathName("c:\somefile.txt")
getname = filesys.GetFileName(path)
DateCreated = filetxt.DateCreated
DateLastAccessed = filetxt.DateLastAccessed
DateLastModified = filetxt.DateLastModified

filetxt.Close
If filesys.FileExists(path) Then
Response.Write ("Your file, '" & getname & "', has been created.")
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top