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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preserver original create date when copying files

Status
Not open for further replies.

DotNetNewbie

Programmer
Mar 3, 2004
344
0
0
GB
Hi,

I am working on a script that checks a server based DLL file, which then needs to be copied onto workstations if the file is newer than the current file.

I had intended on using .DateLastModified however this changes everytime a user logs into the associated program. I then decided to use the .DateCreated, however this also fails as then I do a .CopyFile it changes the DateCreated to todays date/time.

Is there anyway to prevent the .CopyFile from changing the Date Created, i.e. preserve the original creation date?

Any other suggestions welcome.

.net
 
That's bitten me before too. Unfortunately, I do know of an easy way to do it.

The only way I can think of is by changing the meta data of said file but that would be a rather arduous - especially with VBS.

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Have a look at this thread on mrexcel.com:
The code posted is VBA so it won't run directly as VBScript (not sure if it can be converted over to VBScript) but there are also a few utilities discussed that might be worth investigating.
 
The problem is that the date properties of a file (.DateAccessed, .DateModified, and .DateCreated) are read-only properties in VBS.

As the posted link suggests, you would probably need to use a more robust language to accomplish this.

Instead of changing the files create date, you could copy it into a file and update/maintain with every copy.

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top