Is there a way to check if the file is all there?
For example a 300 mb file is being downloaded by some other automated FTP program and the automise script kicks off. Is there a way to check that the file is "not all there" and fail the job?
Is there a way to check if the file is all there?
For example a 300 mb file is being downloaded by some other automated FTP program and the automise script kicks off. Is there a way to check that the file is "not all there" and fail the job?
Hi
This may be difficult to determine without some information about the file prior to the download (size or checksum). If you can get the checksum for the file before the download then you can compare this information once the download has completed.
Regards,
Steve
If the file is being written by some other program that it will have the "lock" right? Is there a way to tell if a "lock" exists on that file maybe?
Possibly, you maybe able to use a simple script to check if the file is locked.
I have used a script such as this in the past (VBScript)..
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Dim fsObject
Dim fileObject
Dim textStream
Dim fileName
On Error Resume Next
Set fsObject = CreateObject("Scripting.FileSystemObject")
' Set Filename here of a file to check for locking
fileName = "C:\Build_Env\7.3.2_STR\Installs\Install\Disk1\setup.exe"
If Not FileExists(fileName) Then
Action.SendLogMessage "File Does Not Exist " & fileName, stInformation
Exit Sub
End If
Set fileObject = fsObject.GetFile(fileName)
Set textStream = fileObject.OpenAsTextStream(ForAppending, -2)
If Err.Number = 70 Then
Action.SendLogMessage "File Locked: " & fileName, stError
ActionResult = False
Exit Sub
End If
Err.Clear
Action.SendLogMessage "File Not Locked: " & fileName, stSuccess