@ECHO OFF
REM CTONWD.BAT - Upload with diagnostic pauses (8.3 name)
REM Version: 1.1 - Debug version for recording
REM Last modified: 2026-01-21

ECHO.
ECHO ==============================================================
ECHO DEBUG: CTONW - Computer to Network Upload
ECHO ==============================================================
ECHO.

IF "%MACHINE%"=="" GOTO NO_MACHINE

ECHO CTONW Step 0: Verifying prerequisites
ECHO   MACHINE = %MACHINE%
IF NOT EXIST T:\*.* GOTO NO_DRIVE
ECHO   T: drive OK
IF NOT EXIST T:\%MACHINE%\*.* GOTO NO_FOLDER
ECHO   T:\%MACHINE% OK
ECHO.
PAUSE

IF NOT EXIST C:\ATE\*.* GOTO SKIP_ATE

ECHO.
ECHO CTONW Step 1: Creating LOGS directories on T:\%MACHINE%\LOGS
IF NOT EXIST T:\%MACHINE%\LOGS\*.* MD T:\%MACHINE%\LOGS
IF NOT EXIST T:\%MACHINE%\LOGS\5BLOG\*.* MD T:\%MACHINE%\LOGS\5BLOG
IF NOT EXIST T:\%MACHINE%\LOGS\7BLOG\*.* MD T:\%MACHINE%\LOGS\7BLOG
IF NOT EXIST T:\%MACHINE%\LOGS\8BLOG\*.* MD T:\%MACHINE%\LOGS\8BLOG
IF NOT EXIST T:\%MACHINE%\LOGS\DSCLOG\*.* MD T:\%MACHINE%\LOGS\DSCLOG
IF NOT EXIST T:\%MACHINE%\LOGS\HVLOG\*.* MD T:\%MACHINE%\LOGS\HVLOG
IF NOT EXIST T:\%MACHINE%\LOGS\PWRLOG\*.* MD T:\%MACHINE%\LOGS\PWRLOG
IF NOT EXIST T:\%MACHINE%\LOGS\SCTLOG\*.* MD T:\%MACHINE%\LOGS\SCTLOG
IF NOT EXIST T:\%MACHINE%\LOGS\VASLOG\*.* MD T:\%MACHINE%\LOGS\VASLOG
ECHO   Directories ready
PAUSE

ECHO.
ECHO CTONW Step 2: Uploading 5BLOG
IF EXIST C:\ATE\5BLOG\*.DAT ECHO   Found files in C:\ATE\5BLOG
IF EXIST C:\ATE\5BLOG\*.DAT COPY C:\ATE\5BLOG\*.DAT T:\%MACHINE%\LOGS\5BLOG
IF NOT EXIST C:\ATE\5BLOG\*.DAT ECHO   No files in C:\ATE\5BLOG
PAUSE

ECHO.
ECHO CTONW Step 3: Uploading 7BLOG
IF EXIST C:\ATE\7BLOG\*.DAT ECHO   Found DAT files in C:\ATE\7BLOG
IF EXIST C:\ATE\7BLOG\*.DAT COPY C:\ATE\7BLOG\*.DAT T:\%MACHINE%\LOGS\7BLOG
IF EXIST C:\ATE\7BLOG\*.SHT ECHO   Found SHT files in C:\ATE\7BLOG
IF EXIST C:\ATE\7BLOG\*.SHT COPY C:\ATE\7BLOG\*.SHT T:\%MACHINE%\LOGS\7BLOG
IF NOT EXIST C:\ATE\7BLOG\*.* ECHO   No files in C:\ATE\7BLOG
PAUSE

ECHO.
ECHO CTONW Step 4: Uploading 8BLOG
IF EXIST C:\ATE\8BLOG\*.DAT ECHO   Found files in C:\ATE\8BLOG
IF EXIST C:\ATE\8BLOG\*.DAT COPY C:\ATE\8BLOG\*.DAT T:\%MACHINE%\LOGS\8BLOG
IF NOT EXIST C:\ATE\8BLOG\*.DAT ECHO   No files in C:\ATE\8BLOG
PAUSE

ECHO.
ECHO CTONW Step 5: Uploading DSCLOG
IF EXIST C:\ATE\DSCLOG\*.DAT ECHO   Found files in C:\ATE\DSCLOG
IF EXIST C:\ATE\DSCLOG\*.DAT COPY C:\ATE\DSCLOG\*.DAT T:\%MACHINE%\LOGS\DSCLOG
IF NOT EXIST C:\ATE\DSCLOG\*.DAT ECHO   No files in C:\ATE\DSCLOG
PAUSE

ECHO.
ECHO CTONW Step 6: Uploading HVLOG
IF EXIST C:\ATE\HVLOG\*.DAT ECHO   Found files in C:\ATE\HVLOG
IF EXIST C:\ATE\HVLOG\*.DAT COPY C:\ATE\HVLOG\*.DAT T:\%MACHINE%\LOGS\HVLOG
IF NOT EXIST C:\ATE\HVLOG\*.DAT ECHO   No files in C:\ATE\HVLOG
PAUSE

ECHO.
ECHO CTONW Step 7: Uploading PWRLOG
IF EXIST C:\ATE\PWRLOG\*.DAT ECHO   Found files in C:\ATE\PWRLOG
IF EXIST C:\ATE\PWRLOG\*.DAT COPY C:\ATE\PWRLOG\*.DAT T:\%MACHINE%\LOGS\PWRLOG
IF NOT EXIST C:\ATE\PWRLOG\*.DAT ECHO   No files in C:\ATE\PWRLOG
PAUSE

ECHO.
ECHO CTONW Step 8: Uploading SCTLOG
IF EXIST C:\ATE\SCTLOG\*.DAT ECHO   Found files in C:\ATE\SCTLOG
IF EXIST C:\ATE\SCTLOG\*.DAT COPY C:\ATE\SCTLOG\*.DAT T:\%MACHINE%\LOGS\SCTLOG
IF NOT EXIST C:\ATE\SCTLOG\*.DAT ECHO   No files in C:\ATE\SCTLOG
PAUSE

ECHO.
ECHO CTONW Step 9: Uploading VASLOG
IF EXIST C:\ATE\VASLOG\*.DAT ECHO   Found files in C:\ATE\VASLOG
IF EXIST C:\ATE\VASLOG\*.DAT COPY C:\ATE\VASLOG\*.DAT T:\%MACHINE%\LOGS\VASLOG
IF NOT EXIST C:\ATE\VASLOG\*.DAT ECHO   No files in C:\ATE\VASLOG
PAUSE

ECHO.
ECHO CTONW Step 10: Uploading Reports
IF NOT EXIST T:\%MACHINE%\Reports\*.* MD T:\%MACHINE%\Reports
IF EXIST C:\Reports\*.TXT ECHO   Found TXT files in C:\Reports
IF EXIST C:\Reports\*.TXT COPY C:\Reports\*.TXT T:\%MACHINE%\Reports
IF NOT EXIST C:\Reports\*.TXT ECHO   No TXT files in C:\Reports
PAUSE

ECHO.
ECHO ==============================================================
ECHO CTONW-DEBUG Complete
ECHO ==============================================================
GOTO END

:SKIP_ATE
ECHO.
ECHO CTONW: No C:\ATE directory found - skipping upload
PAUSE
GOTO END

:NO_MACHINE
ECHO.
ECHO CTONW ERROR: MACHINE variable not set
PAUSE
GOTO END

:NO_DRIVE
ECHO.
ECHO CTONW ERROR: T: drive not available
PAUSE
GOTO END

:NO_FOLDER
ECHO.
ECHO CTONW ERROR: T:\%MACHINE% folder not found
PAUSE
GOTO END

:END
