File creation date. No change?
- From: Tec92407 <Tec92407@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Apr 2007 14:30:01 -0700
I have a vbscript script that archives a file by moving it to an archive
folder, before ftp downloading another version of the file. When the file is
archived, its moved from the download folder to the archive folder and
renamed to a different filename. The file name of the downloaded file is
always the same.
The problem-
The first thing the script does is archive the file. So the file is moved
from the download folder to the archive folder and renamed. What I expect is
that when a new file is ftp downloaded, it would have a newer creation date
than the archived file, since there is no existing file in the download
folder. But what I'm finding is that the new file has a newer modified date
and the same creation date!
What am I missing?
Script below:
'Archive the previously downloaded file.
If (objFSO.FileExists(strDataFolder & "\" & strDataFile)) Then
strTmpFA = GetFileAttribs(strDataFolder, strDataFile)
strFileAttribs = split (strTmpFA,",")
strFileCDate = Mid(strFileAttribs(3),1,8)
intN = 0
strTmpFCD = strFileCDate
' Loop till we get a unique filename
Do while objFSO.FileExists (strArcFolder & "\" & strDataFile & "-" &
strTmpFCD)
intN = intN + 1
strTmpFCD = strFileCDate & "-" & intN
Loop
strFileCDate = strTmpFCD
' Move the file using new filename
objFSO.MoveFile strDataFolder & "\" & strDataFile, strArcFolder & "\" &
strDataFile & "-" & strFileCDate
End if
' FTP the next file
objShell.Run "%comspec% /C ftp -s:" & strFTPCmdFile & " >" & strTmp, 0, True
' Get and return file attributes
Function GetFileAttribs(strFPath, strTargetFile)
Dim strNewDstPath, arrFileAttrib(4)
Dim objWMIService, objFile, colFiles
strNewDstPath = strFPath & "\" & strTargetFile
'filepath must use \\ instead of \
strNewDstPath = Replace(strNewDstPath,"\","\\")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where name = '" & strNewDstPath & "'")
for each objFile in colFiles
arrFileAttrib(0) = objFile.FileName & "." & objFile.Extension
arrFileAttrib(1) = objFile.Drive & objFile.Path
arrFileAttrib(2) = objFile.FileSize
arrFileAttrib(3) = objFile.CreationDate
next
GetFileAttribs = join (arrFileAttrib,",")
End Function
.
- Follow-Ups:
- Re: File creation date. No change?
- From: Richard Mueller [MVP]
- Re: File creation date. No change?
- Prev by Date: Re: Deleting computer accounts in AD
- Next by Date: Event log check
- Previous by thread: Re: Deleting computer accounts in AD
- Next by thread: Re: File creation date. No change?
- Index(es):
Relevant Pages
|