.key src,dst,flg
.def src SOURCE
.def dst DESTINATION
.def flg DEL_COPY
.bra {
.ket }

c:echo >ram:datefile "Start = " NOLINE
c:date >>ram:datefile

IF {src} EQ SOURCE
    ECHO "Usage: cmpPATH  <SOURCEdir> <DESTINATIONdir> [CMPONLY]"
    QUIT
ENDIF

IF NOT EXISTS {src}
    ECHO "SOURCE path does not exist"
    QUIT 20
ENDIF

IF NOT EXISTS {dst}
    ECHO "DESTINATION path does not exist"
    QUIT 20
ENDIF

IF {flg} NOT EQ CMPONLY
    FAILAT 30

    c:info {dst}

    c:echo ""
    c:echo "[33mRELABEL[m {dst} to 'Test Disk'"
    c:relabel {dst} "Test Disk"

    c:echo ""
    c:echo "[33mMAKE CURRENT DIRECTORY[m to {dst}"

    c:assign DST: {dst}

    c:protect DST:testdir RWED
    c:delete DST:testdir all QUIET

    c:echo ""
    c:echo "[33mMAKE DIRECTORY[m on {dst}"
    c:makedir DST:testdir
    IF FAIL
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mRENAME[m path across directories on {dst}"
    c:rename DST:#? DST:testdir/#?
    IF FAIL
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mRENAME[m files back to original path"
    c:rename DST:testdir/#? DST:#?
    IF FAIL
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mSET FILE DATES[m on {dst} to current date"
    c:setdate DST:#?
    IF FAIL
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mSET FILE ATTRIBUTES[m on {dst} to 'HSPA' and clear 'RWED'"
    c:protect DST:#? HSPA
    IF FAIL
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mDELETE[m all files from {dst}"
    delete DST:#? all
    IF WARN
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mSET FILE ATTRIBUTES[m on {dst} to 'RWED'"
    c:protect DST:#? RWED
    IF FAIL
        SKIP PREEXIT
    ENDIF

    c:echo ""
    c:echo "[33mDELETE[m remaining files from {dst}"
    delete DST:#? all
    IF WARN
        SKIP PREEXIT
    ENDIF

    c:info {dst}

    c:echo ""
    c:echo "[33mCOPY[m {src} to {dst}"
    c:copy {src} to {dst} all

    c:info {dst}

    c:FAILAT 5
ENDIF

c:echo ""
c:echo "[33mCOMPARE[m {src} to {dst}"
c:cmp {src} {dst} all

LAB PREEXIT
c:assign DST:

c:echo >>ram:datefile "End   = " NOLINE
c:date >>ram:datefile
c:type ram:datefile
c:QUIT