1.

Solve : File check and is available to be processed?

Answer»

I have the following CODE to check to see if a file exists and if it is available to be processed because it might be in the process of being copied once the job starts polling for the file.  For some reason this code seems to null the file once it sees it being copied.

I am using Microsoft windows Version 6.1.7601 of DOS

:CHECK_FOR_FILE_LOCK

IF EXIST %FILEPATH%%FILE% (
      ( (CALL ) >>%FILEPATH%%FILE% ) 2>nul && (

         CALL::CaptureCurrentDateTimeDetails
         ECHO !LogDateTimeStamp!: %FILEPATH%%FILE% IS UNLOCKED AND AVAILABLE TO COPY >>%LOGPATH%%scriptname%%logext%
         
         ECHO. >>%LOGPATH%%SCRIPTNAME%%logext%
         
         GOTO ENDJOB
         ) || (

         CALL::CaptureCurrentDateTimeDetails
         ECHO !LogDateTimeStamp!: IT APPEARS THE %FILEPATH%%FILE% IS STILL BEING COPIED. WILL CHECK AGAIN IN 30 SECS >>%LOGPATH%%scriptname%%logext%

         ping 127.0.0.1 -n 30 -w 1000 > nul
         GOTO CHECK_FOR_FILE_LOCK
         )
      )

:ENDJOB
   SEND SUCCESS EMAIL



Discussion

No Comment Found