![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Set File Creation Date I have a script that deletes a file 'MyFile.txt' on the local computer and then copies a newer version of the same file from a network location to the local computer at the same location as the one it just deleted. That's okay, but then another process relies on the newly copied file on the local computer to have a file creation date equal to when the file was copied. The file creation date seems to be a very hit and miss affair in terms of how the NTFS file system manages it, sometimes I get a new file creation date, sometimes not. After much investigation into how NTFS works I have concluded that file creation date is not a particularly reliable way of keeping tabs on just how old a file is - however, be that as it may, I am stuck with it. So my question is this - using vbscript, can I set the file creation date at the time of the copy or is this beyond vbscript? Thanks for any help. -- Regards - Peter |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Set File Creation Date Peter wrote: Quote: > I have a script that deletes a file 'MyFile.txt' on the local computer and > then copies a newer version of the same file from a network location to Quote: > local computer at the same location as the one it just deleted. > > That's okay, but then another process relies on the newly copied file on Quote: > local computer to have a file creation date equal to when the file was Quote: > > The file creation date seems to be a very hit and miss affair in terms of > how the NTFS file system manages it, sometimes I get a new file creation > date, sometimes not. > > After much investigation into how NTFS works I have concluded that file > creation date is not a particularly reliable way of keeping tabs on just Quote: > old a file is - however, be that as it may, I am stuck with it. > > So my question is this - using vbscript, can I set the file creation date Quote: > the time of the copy or is this beyond vbscript? The key is the 15 second delay between delete and copy. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Set File Creation Date Instead of waiting 15 seconds it's better to do 3rd option from WShell.Run - WaitOnRun WshShell.Run(Command, [WindowStyle], [WaitOnRun]) You don't have to wait some part of time (by guessing how long it should wait on it) Regards, esska |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Set File Creation Date esska wrote: Quote: > Instead of waiting 15 seconds it's better to do 3rd option from > WShell.Run - WaitOnRun > WshShell.Run(Command, [WindowStyle], [WaitOnRun]) > > You don't have to wait some part of time (by guessing how long it > should wait on it) it works, please post the actual code that you used. In the meantime, 15 seconds is not a guess. it's a default time set by Windows. Read the following about File System Tunneling (which I recently learned about in microsoft.public.scripting.wsh). http://support.microsoft.com/?kbid=172190 -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Set File Creation Date "Todd Vargo" wrote: Quote: > esska wrote: Quote: > > Instead of waiting 15 seconds it's better to do 3rd option from > > WShell.Run - WaitOnRun > > WshShell.Run(Command, [WindowStyle], [WaitOnRun]) > > > > You don't have to wait some part of time (by guessing how long it > > should wait on it) > Try it your way. The file creation date will not be reset. In the off chance > it works, please post the actual code that you used. > > In the meantime, 15 seconds is not a guess. it's a default time set by > Windows. Read the following about File System Tunneling (which I recently > learned about in microsoft.public.scripting.wsh). > > http://support.microsoft.com/?kbid=172190 > > -- > Todd Vargo > (Post questions to group only. Remove "z" to email personal messages) > more reliable result, pity about the introduced delay but can't be avoided. I had read all about File System Tunnelling, I must admit, I never realised that the file system did so much until I started investigating this issue. Thanks again for the help. Peter |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How do I get a folder's creation date? | PowerShell | |||
| Command line tool to change file creation date? | Vista General | |||
| display document creation date | Vista file management | |||
| How can I preserve creation date in a Copy? | Vista file management | |||
| sort by file creation date | Vista General | |||