home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK5 / DOS_01 / 4DVC31.ZIP / 4DVCPACK.BTM < prev    next >
Text File  |  1991-01-04  |  6KB  |  161 lines

  1. @echo off
  2.    cls
  3.    @md 4DVCPACK >&! NUL
  4.    @cd 4DVCPACK
  5.    echo %@upper[%@name[%1].%@ext[%1]]: >>&! ..\4DVCPACK.0
  6.    @del /qy *.* >&! NUL
  7.    echo Extracting all versions of all files from %@name[%1].%@ext[%1]...
  8.    PKUNZIP -en ..\%@name[%1].%@ext[%1] >&! NUL
  9.    set VCZIP=%?
  10.    if %VCZIP EQ 0 PKZIP -q-vcbne ..\%@name[%1].%@ext[%1] >&! 4DVCPACK.0
  11.    iff %? EQ 0 then
  12.       iff %VCZIP EQ 0 then
  13.          goto DOIT
  14.       endiff
  15.    endiff
  16.    set VCZIP=
  17.    cd ..
  18.    @del /qy 4DVCPACK\*.* >&! NUL
  19.    @rd 4DVCPACK
  20.    echo     Could not unZIP all archive files and comments. Make sure there is     >>&! ..\4DVCPACK.0
  21.    echo     enough room on your disk, and that it is not write/password protected. >>&! ..\4DVCPACK.0
  22.    echo -------------------------------------------------------------------------------- >>&! ..\4DVCPACK.0
  23.    quit
  24. :DOIT
  25.    set VCZIP=
  26.    set VCRCD=8
  27. :DESCTOP
  28.    if %@len[%@line[4DVCPACK.0,%VCRCD]] EQ 0 goto DESCEND
  29.    if "%@substr[%@line[4DVCPACK.0,%VCRCD],1,6]" EQ "------" goto DESCIN
  30. :DESCOUT
  31.    set VCRCD=%@eval[%VCRCD + 1]
  32.    goto DESCTOP
  33. :DESCIN
  34.    set VCRCD=%@eval[%VCRCD + 1]
  35.    if "%@substr[%@line[4DVCPACK.0,%VCRCD],1,6]" EQ "------" goto DESCOUT
  36.    set VCNAM=%@substr[%@line[4DVCPACK.0,%VCRCD],46,12]
  37.    set VCRCD=%@eval[%VCRCD + 1]
  38.    set VCCOM=%@substr["%@line[4DVCPACK.0,%VCRCD]                                                   ",10,41]
  39.    describe %VCNAM "%VCCOM"
  40.    set VCCOM=
  41.    set VCNAM=
  42.    goto DESCIN
  43. :DESCEND
  44.    set VCRCD=
  45.    @del /q 4DVCPACK.0 >&! NUL
  46.    set VCEXT=
  47.    set VCNAM=
  48.    echo *********************************************************************
  49.    echo Resequencing files...
  50.    for %%Z in (*.*) do gosub REDUCE
  51. rem handle version 1000 if any exist
  52.    iff exist *.000 then
  53.       for %%Y in (*.000) do gosub BUMP1000
  54.       set VCEXT=
  55.       set VCNAM=
  56.       for %%Z in (*.*) do gosub REDUCE
  57.       if exist *.000 del /q *.000 >&! NUL
  58.       if exist *.@@@ ren /q *.@@@ *.000 >&! NUL
  59.    endiff
  60.    set VCEXT=
  61.    set VCNAM=
  62.    set VCWRK=
  63.    echo *********************************************************************
  64.    iff "%VCZIP" EQ "" then
  65.       echo     No Resequencing was performed. Archives already PACKed. >>&! ..\4DVCPACK.0
  66.       goto WRAPUP
  67.    endiff
  68.    echo Rearchiving newly resequenced files...
  69.    for %%Z in (*.*) do gosub SAVEIT
  70.    iff %? NE 0 then
  71.       echo     Could not reZIP all archive files and comments. Make sure there is >>&! ..\4DVCPACK.0
  72.       echo     enough room on your disk. >>&! ..\4DVCPACK.0
  73.    else
  74.       copy %@name[%1].%@ext[%1] ..\*.* >&! NUL
  75.    endiff
  76. :WRAPUP
  77.    echo -------------------------------------------------------------------------------- >>&! ..\4DVCPACK.0
  78.    cd ..
  79.    set VCZIP=
  80.    @del /qy 4DVCPACK\*.* >&! NUL
  81.    @rd 4DVCPACK
  82.    quit
  83. rem *******************************************************************
  84. rem *
  85. rem *  This routine renames version 1000 to:
  86. rem *     999 if there is not currently a 999 version
  87. rem *     @@@ if there is a 999 version (in which case, version 1000
  88. rem *         will remain 000 and get renamed back to 000 later on)
  89. rem *
  90. rem *******************************************************************
  91. :BUMP1000
  92.    iff exist %@name[%Y].999 then
  93.       ren /q %Y *.@@@ >&! NUL
  94.       return
  95.    endiff
  96.    copy %Y *.999 >&! NUL
  97.    return
  98. rem *******************************************************************
  99. rem *
  100. rem *  This routine processes each file in the subdirectory. When a
  101. rem *  name-break occurs, the "expected" version number is reset to
  102. rem *  001, and incrimented by 1 for each file of the same name. If
  103. rem *  the actual extension of the file does not match the expected
  104. rem *  extension (version), the file is renamed.
  105. rem *
  106. rem *******************************************************************
  107. :REDUCE
  108.    set VCWRK=%@upper[%Z]
  109. rem **** we won't touch version 1000 in this loop
  110.    if "%@ext[%VCWRK]" EQ "000" return
  111.    if "%@ext[%VCWRK]" EQ "@@@" return
  112. rem **** test for filename break
  113.    iff "%@name[%VCWRK]" NE "%VCNAM" then
  114.       set VCNAM=%@name[%VCWRK]
  115.       set VCEXT=001
  116.    else
  117.       set VCEXT=%@eval[%VCEXT + 1]
  118.       if %@len[%VCEXT] EQ 1 set VCEXT=00%VCEXT
  119.       if %@len[%VCEXT] EQ 2 set VCEXT=0%VCEXT
  120.       if %@len[%VCEXT] EQ 4 set VCEXT=000
  121.    endiff
  122. rem **** rename the file if not at the expected version number
  123.    iff "%@ext[%VCWRK]" NE "%VCEXT" then
  124.       echo    %VCWRK  renamed to %@name[%VCWRK].%VCEXT
  125.       echo    %VCWRK  renamed to %@name[%VCWRK].%VCEXT >>&! ..\4DVCPACK.0
  126.       ren /q %VCWRK %@name[%VCWRK].%VCEXT
  127.       set VCZIP=X
  128.    endiff
  129.    return
  130. rem *******************************************************************
  131. rem *
  132. rem *  This routine locates the comment for each file in turn and
  133. rem *  calls PKZIP to add the file to the archive with the comment.
  134. rem *  If everything went ok, the file is deleted (mking room for more
  135. rem *  files in the archive if disk space is short.
  136. rem *
  137. rem *******************************************************************
  138. :SAVEIT
  139.    if %? NE 0 return
  140.    if "%@upper[%@ext[%Z]]" EQ "ZIP" return
  141.    set VCRCD=0
  142. :FINDDESC
  143.    iff "%@line[DESCRIPT.ION,%VCRCD]" EQ "" then
  144.       keystack "No Comments Provided " 13
  145.       goto HAVEDESC
  146.    endiff
  147.    iff %@index["%@upper[%@line[DESCRIPT.ION,%VCRCD]]",%@upper[%@name[%Z].%@ext[%Z]]] EQ 1 then
  148.       keystack "%@substr["%@line[DESCRIPT.ION,%VCRCD]                                         ",%@eval[%@len[%@name[%Z].%@ext[%Z]]+2],40]" 13
  149.    else
  150.       set VCRCD=%@eval[%VCRCD + 1]
  151.       goto FINDDESC
  152.    endiff
  153. :HAVEDESC
  154.    set VCRCD=
  155.    set VCZIP=%@substr[%@name[%1],4,%@eval[%@len[%@name[%1]] - 4]]
  156.    echo    %@upper[%Z]
  157.    @pkzip -uqc 4DVC%VCZIP.ZIP %Z >&! NUL
  158.    if %? EQ 0 @del /q %Z >&! NUL
  159.    set VCZIP=
  160.    return
  161.