Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: File check and is available to be processed  (Read 3539 times)

0 Members and 1 Guest are viewing this topic.

glabrecque

    Topic Starter


    Newbie

    • Experience: Experienced
    • OS: Other
    File check and is available to be processed
    « on: August 05, 2019, 08:51:10 AM »
    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