DOS: Folder-To-ISO Archive Engine

BCScript.txt

 

# Loads PORTABLE DtoKMirror
log normal "%3"
load "%1" "%2"
select all
compare rules-based
folder-report layout:side-by-side output-to:"%3" output-options:html-color

 

Script Code

 

@echo off
@title "ZIP Drive Builder v14.02"
:: PROGRAM NOTES
:: Add Prompt Routine for Moving to _DeleteZip Folder
:: Append for.txt with value and automatically move folder


::Variables List
set src=
set dest=
set ARCHIVETYPE=ZIP
set Filter=
set RenewSrc=
set Volume=
set CDROM=F:
set DVDDRIVE=Z:
set renewdir=1
set test=
set PROGISO=cdrtools\mkisofs
set PROGISO2="D:\PORTABLE\Disk\ImgBurn_2.4.2.0.Portable\ImgBurnPortable.exe"
set PROGIMG="imgburn\ImgBurnPortable.exe"
set PROGFXP="flashfxp\flashfxp.exe
:: set PROGIMG="D:\PORTABLE\Disk\ImgBurn_2.4.2.0.Portable\ImgBurnPortable.exe"
set PROGRAR="winrar\rar"
set IMGBURN=
set PROGZIP=7zip\7z
set PROGPAR="par\par2.exe"
set PROGCOMP="C:\Program Files (x86)\Beyond Compare 3\BCompare.exe"
set PROGDVD="C:\Program Files (x86)\DAEMON Tools Pro\DTAgent.exe"



:: set src=%filename:~0,6%.zip

:: set dest=D:\TEMP
:: set src=D:\TEMP
:: set ARCHIVETYPE=IMG

:INFO
:: echo handle files only
:: dir

:MENU
echo -----------------------------
echo.
echo.
echo Source     : %SRC%
echo Destination: %DEST%
echo ArchiveType: %ARCHIVETYPE%
echo Filter     : %FILTER%
echo Volume     : %VOLUME%
echo Renew      : %RENEWDIR%
echo Test       : %TEST%
echo.
echo.
echo ------------------------------
echo Press S,D,A,F,R
echo  g for Go
echo  t for Test
echo  x for Exit
set /p STATE=
if "%STATE%" == "s" goto TYPESRC
if "%STATE%" == "d" goto TYPEDEST
if "%STATE%" == "a" goto SELECTARCHIVE
if "%STATE%" == "f" goto TYPEFILTER
if "%STATE%" == "v" goto TYPEVOLUME
if "%STATE%" == "r" goto RENEWDIR
if "%STATE%" == "t" goto TEST
if "%STATE%" == "g" goto GO
if "%STATE%" == "x" goto EXIT
goto MENU


:TYPESRC
echo Type Path of Source (i.e. D:\TRANSFER)
set /p SRC=
echo Source is "%SRC%"
goto MENU





:TYPEDEST
set SAME=
echo Is Destination the same as Source?
set /p SAME=
echo Answer: %SAME%

if "%SAME%" == "y" goto TYPESAME
goto TYPENEW

:TYPESAME
set DEST=
set DEST=%SRC%
echo Using Source as Destination %DEST%
goto TYPEEND



:TYPENEW
echo Type Path for Destination i.e. E: no backslash
set /p DEST=
echo New Destination: %DEST%


:TYPEEND
echo "%SRCLIST%"
set SRCLIST=%DEST%\source.txt
echo "%SRCLIST%"
goto MENU

:TYPEFILTER
echo Type Filter, if any (i.e. *.doc)
set /p FILTER=
goto MENU


:TYPEVOLUME
echo Type Volume (i.e. CDVOLUME)
set /p VOLUME=
goto MENU


:SELECTARCHIVE
echo.
echo.
echo Type one of the follwing to
echo Begin archiving
echo --------------
echo IMG = IMG
echo PAR = PAR
echo RAR = RAR
echo ISO  = ISO
echo ZIP  = ZIP
echo UNZIP= UNZIP
echo COPY = COPY
echo DIR  = DIRECTORY
echo --------------
echo.
set /p ARCHIVETYPE=
goto MENU
:RENEWDIR
set SRCLIST=%DEST%\source.txt
echo Recreating "%SRCLIST%"
dir %SRC% /b /ad > %SRCLIST%
echo Recreated "%SRCLIST%"
goto MENU

::_______________________________________________________________________
:GO
echo Starting %ARCHIVETYPE%MAKER Routines
goto %ARCHIVETYPE%MAKER
goto ABORT

:UNISOMAKER
cls
echo.
echo Description:
echo -----------------------------------
echo 1) src list should only have the FolderName, NOT full path
echo 2) Mounts *.iso to DVDDRIVE [usually Z]
echo 3) Copies DVDDRIVE[Z:] to DEST dir
echo 4) Compares DEST dir to DVDDRIVE to html
echo
echo
echo DaemonTools: %PROGDVD%
echo SRC: %SRC%
echo DEST:   %DEST%
echo DRIVE: %DVDDRIVE%
::echo Report: %DEST%\%%i.html
set SRCLIST=%SRC%\source.txt
echo SourceList: %SRCLIST%
echo ------------------------------------------------
echo.
pause
:UNISOENGINE
pause
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo %TIME%
    echo Current Item: %%i
    IF EXIST "%SRC%\%%i\%%i.iso" (
        echo Detected ISO File...
        echo Mounting..."%SRC%\%%i\%%i.iso"
        echo %PROGDVD% -mount dt,0,"%SRC%\%%i\%%i.iso" - to - %DVDDRIVE%
                 %PROGDVD% -mount dt,0, "%SRC%\%%i\%%i.iso"
        echo.
        echo Mount Complete: %DVDDRIVE%
        echo %%i
        echo md "%DEST%\%%i"
        md "%DEST%\%%i"
        echo xcopy /E/F/Y/H/R/V  %DVDDRIVE%\*.* "%DEST%\%%i\"
        xcopy /E/F/Y/H/R/V  %DVDDRIVE%\*.* "%DEST%\%%i\"
        echo.
        echo Copy ISO End.
        echo %TIME%
        echo Compare Start...%DVDDRIVE% to  %SRC%\
        echo.
        %PROGCOMP% @"BCScript.txt"  "%DEST%\%%i\"  "%DVDDRIVE%" "%DEST%\%%i.html"
        echo.
        echo Compare End.
        echo %TIME%
        echo.
        echo.
    )
)


goto MENU
        ::set CURDIR=%%~nxi
        ::echo %CURDIR%
        ::set thisfile=%thisfile:~nx
        ::set thisdir=%%1:~0,4%
        ::echo Compare Start...%DVDDRIVE% to  %SRC%\
        ::%PROGCOMP% @"BCScript.txt"  "%SRC%\%%i\"  "%DVDDRIVE%" "%DEST%\%%i.html"
::_______________________________________________________________________



:COMPMAKER
echo.
echo Beyond Compare: %PROGCOMP%
echo FROM: %SRC%
echo TO:   %DEST%
echo DRIVE: %DVDDRIVE%
echo Report: %DEST%\%%i.html
echo SourceList: %SRCLIST%
echo ------------------------------------------------
echo.
:COMPENGINE
:: "BComp.exe" "@D:\TEMP\BSCRIPT.txt "%item1% %item2% compare > report.html
:: "D:\TEMP\" + item + @".htm"
::DaemonOptions = @"-mount dt, 0, " + quote + DaemonSourceFile + quote;
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo %TIME%
    echo Current Item: %%i
    
    IF EXIST "%SRC%\%%i.iso" (
        echo Detected ISO File...
        echo Mounting..."%SRC%\%%i.iso"
        echo %PROGDVD% -mount dt,0,"%SRC%\%%i.iso" - to - %DVDDRIVE%
                 %PROGDVD% -mount dt,0, "%SRC%\%%i.iso"
        echo.
        echo Mount Complete: %DVDDRIVE%
        echo Compare Start...%DVDDRIVE% to  %SRC%\
        %PROGCOMP% @"BCScript.txt"  "%SRC%\%%i\"  "%DVDDRIVE%" "%DEST%\%%i.html"
        echo.
        echo Compare End.
        echo %TIME%
        echo.
    )

    IF NOT EXIST "%SRC%\%%i.iso" (    
        echo.
        echo Detected MultiFile ISO Set... attempting the *.MDS
        echo.
        
        
        IF EXIST "%SRC%\%%i.mds" (
            echo Mounting..."%SRC%\%%i.mds"
            echo %PROGDVD% -mount dt,0,"%SRC%\%%i.mds" - to - %DVDDRIVE%
                     %PROGDVD% -mount dt,0, "%SRC%\%%i.mds"
            echo.
            echo Mount Complete: %DVDDRIVE%
            echo Compare Start...%DVDDRIVE% to  %SRC%\
            echo.
            %PROGCOMP% @"BCScript.txt"  "%SRC%\%%i\"  "%DVDDRIVE%" "%DEST%\%%i.html"
            echo.
            echo Compare End.
            echo %TIME%
            echo.
        )
                        
        IF NOT EXIST "%SRC%\%%i.mds" (
            echo.
            echo.
            echo No valid ISO file found.
            echo.
            echo.
            dir /b
            pause
        )
        
    )
        

)

    
goto MENU
::____________________________________________________________________




:COPYMAKER
echo.
echo.
echo.
echo Copying from the Folders in %SRC%
type %SRCLIST% | more
echo.
echo ...Ready?
pause
:COPYENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo Copying from  %SRC%\%%i to %DEST%\%%i
    xcopy /E/F/Y/H/R/V  %SRC%\%%i %DEST%\%%1
    echo ..Done with copying
    echo ---------------------------------------
    echo.
    echo.
)
:: type %LOGZIPMAKE%
dir %DEST% |more
echo.
echo.
echo.
echo Completed COPY from %SRC%\ to %DEST%\
echo.
echo.
echo.
goto RESTART

::_______________________________________________________________________
:DIRMAKER
set LOGZIPMAKE=%DEST%\LogDIRMake.txt
echo.
echo.
echo.
echo Creating DIR files from the Folders in %SRC%\
type %SRCLIST% | more
echo.
echo ...Ready?
pause
:DIRENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo md         "%DEST%\%%i\"
    echo move     "%DEST%\%%i.*" "%DEST%\%%i\"
    pause
    md         "%DEST%\%%i\"
    move     "%DEST%\%%i.*" "%DEST%\%%i\"
    echo ..Done with DIR Creation for %SRC%\%%i
    echo ---------------------------------------
    echo.
    echo.
)

pause
echo.
echo.
echo.
echo Completed DIR Creation from %SRC%
pause
goto RESTART
::_______________________________________________________________________

::_______________________________________________________________________



:ZIPMAKER
set LOGZIPMAKE=%DEST%\LogZIPMake.txt
echo.
echo.
echo.
echo Creating ZIP files from the Folders in %SRC%\
type %SRCLIST% | more
echo.
echo ...Ready?
pause
:ZIPENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo %PROGZIP% a "%DEST%\%%i.zip" "%SRC%\%%i"
    echo %PROGZIP% a "%DEST%\%%i.zip" "%SRC%\%%i\" >> %DEST%\ZIPBUILDER.txt
    echo Running %PROGZIP%
    %PROGZIP% a "%DEST%\%%i.zip" "%SRC%\%%i\"
    echo ..Done with ZIP Creation for %SRC%\%%i
    echo ---------------------------------------
    echo.
    echo.
)
pause
::type %LOGZIPMAKE%
echo.
echo.
echo.
echo Completed ZIP Creation from %SRC%
pause
goto RESTART
::_______________________________________________________________________



:UNZIPMAKER
set LOGZIPMAKE=%DEST%\LogUNZIPMake.txt
echo.
echo.
echo.
echo UNZIPPING files from the ZipFiles in %SRC%\*.zip
echo ...Ready?
echo.
pause
:UNZIPENGINE
echo %PROGZIP% x %SRC%\*.zip -o*
echo %PROGZIP% x %SRC%\*.zip -o* >> %DEST%\ZIPBUILDER.txt
echo Running %PROGZIP% Extracting %SRC%
%PROGZIP% x %SRC%\*.zip -o*
pause
echo.
echo.
echo.
echo Completed UNZIPPING from %SRC%\*.zip
pause
goto RESTART
::_______________________________________________________________________



:PARMAKER
set LOGPARMAKE=%DEST%\LogPARMake.txt
echo.
echo.
echo %TIME%
echo.
echo Creating PAR files from the Folders in %SRC%
type %SRCLIST% | more
echo.
echo ...Ready?
pause
:PARENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo Start Time - %TIME%
    IF EXIST "%SRC%\%%i.iso" (
        echo ISO EXISTS - %SRC%\%%i.iso
        pause
        echo.
        echo Running the following command:
        echo par2 create -s307200 -r1 %SRC%\%%i.iso
        %PROGPAR% create -v -s307200 -r1 %SRC%\%%i.par2 %SRC%\%%i.iso
        pause
        :: par2 c(reate) [options] <par2 file> [files]
        echo.
        echo.
        @echo on
        @echo off
        echo.
        echo ..Done with PAR Creation for %SRC%\%%i
        echo End Time - %TIME%
    )
    IF NOT EXIST     "%SRC%\%%i.iso" (
        echo ISO MISSING - %SRC%\%%i.iso
        pause
        echo.
        echo.
        @echo on
        @echo off
        echo.
        echo ..Skipped PAR Creation for %SRC%\%%i
        echo End Time - %TIME%
    )
    echo ---------------------------------------
    echo.
    echo.
)
::type %LOGPARMAKE%
echo.
echo.
echo.
echo Completed PAR Creation from %SRC%
echo.
dir %DEST%
echo.
echo.
echo.
pause
goto RESTART
::_______________________________________________________________________



:ISOMAKER
set LOGISOMAKE=%DEST%\LogISOMake.txt
echo.
echo.
echo.
echo Creating ISO files from the Folders in %SRC%
type %SRCLIST% | more
echo.
echo ...Ready?
pause
:ISOENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo.
    echo Running the following command:
    echo %PROGISO% -V "%%i" -J -l -R -o "%DEST%\%%i.iso" "%SRC%\%%i"
    echo.
    echo.
    @echo on
    @echo off
    :: %PROGISO% -V "%VOLUME%" -J -l -R -o "%DEST%\%VOLUME%.iso" "%SRC%"
    echo.
    echo ..Done with ISO Creation for %SRC%\%%i
    echo ---------------------------------------
    echo.
    echo.
)
::type %LOGISOMAKE%
echo.
echo.
echo.
echo Completed ISO Creation from %SRC%
echo.
dir %DEST%
echo.
echo.
echo.
pause
goto RESTART
::_______________________________________________________________________



:IMGMAKER
set LOGIMGMAKE="%DEST%\LogIMGMake.txt"
echo.
echo.
echo.
echo %TIME%
echo Creating IMG files from the Folders in "%SRC%"
type %SRCLIST% | more
echo.
echo ...Ready?
pause
echo %PROGIMG%

:IMGENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo Current Item: %%i
    echo.
    echo Iteration Start Time - %TIME%
    echo Running the following command:
    echo %PROGIMG% /MODE BUILD /SRC "%SRC%\%%i" /DEST "%DEST%\%%i.iso" /FILESYSTEM "UDF" /UDFREVISION "2.60" /VOLUMELABEL "%%i"  /VOLUMELABEL_UDF "%%i" /NOIMAGEDETAILS /ROOTFOLDER YES /START /CLOSE SUCCESS
    echo.
    echo.
    @echo on
    echo ImageBurn...%%i
    %PROGIMG% /MODE BUILD /SRC "%SRC%\%%i" /DEST "%DEST%\%%i.iso" /FILESYSTEM "UDF" /UDFREVISION "2.60" /VOLUMELABEL "%%i"  /VOLUMELABEL_UDF "%%i" /NOIMAGEDETAILS /ROOTFOLDER YES /START /CLOSE SUCCESS
    @echo off
    echo.
    echo ..Done with ImgBurn ISO Creation for %SRC%\%%i
    echo ---------------------------------------
    echo End Time - %TIME%
    echo.
    echo.
    echo.
    dir /b %SRC%\*.*
    echo.
)
::type %LOGIMGMAKE%
echo.
echo.
echo.
echo End Time - %TIME%
echo Completed IMG/ISO Creation from %SRC%
echo.
dir %DEST%
echo.
echo.
echo.
pause
goto COMPMAKER
::_______________________________________________________________________



:RARMAKER
set LOGRARMAKE=%DEST%\LogRARMake.txt
echo.
echo.
echo.
echo %TIME%
echo Creating RAR files from the Folders in %SRC%
type %SRCLIST% | more
echo.
echo ...Ready?
pause
echo %PROGRAR%
:RARENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo.
    echo Iteration Start Time - %TIME%
    echo Running the following command:
    echo ..Creating RAR Archive for %SRC%\%%i\%%i.i??
    echo ---------------------------------------
        
    IF EXIST "%SRC%\%%i.i??" (
        echo ISO EXISTS - %SRC%\%%i.i??
        pause
        echo.
        echo Running the following command:
        echo    %PROGRAR% a -v -r -m5 -v50000k -rr5 -rv1 %SRC%\%%i.rar %SRC%\%%i.i??
        echo  -r is for Recurse..
                    %PROGRAR% a -v -r -m5 -v50000k -rr5 -rv1 %SRC%\%%i.rar %SRC%\%%i.i??
        :: echo %PROGRAR% a -r -v -m5 -v50000k -rr10 -rv1 %SRC%\%%i.rar %SRC%\%%i.iso
        echo.
        echo.
        echo.
        echo Iteration End - %TIME%
        echo.
        echo ..Done Creating RAR Archive from %SRC%\%%i.i??
        echo ...........................................to     %SRC%\%%i.rar
        echo.
        echo.
        @echo on
        @echo off
        echo.
        echo ..Done with RAR Creation for %SRC%\%%i.i??
        echo End Time - %TIME%
    )
    IF NOT EXIST     "%SRC%\%%i.i??" (
        echo ISO MISSING - %SRC%\%%i.i??
        pause
        echo.
        echo.
        @echo on
        @echo off
        echo.
        echo ..Skipped RAR Creation for %SRC%\%%i.i??
        echo End Time - %TIME%
    )
    echo ---------------------------------------
    echo End Time - %TIME%
    echo.
    echo.
    echo Iteration End - %TIME%
    echo.
    echo ..Done Creating RAR Archive for %SRC%\%%i.i??
    dir /b %SRC%\*.*
    echo.
)
::type %LOGRARMAKE%
echo.
echo.
echo.
echo End Time - %TIME%
echo Completed RAR Creation from %SRC%
echo.
dir %DEST%
echo.
echo.
echo.
pause
goto RESTART
::_______________________________________________________________________





:FTPMAKER
set LOGFTPMAKE=%DEST%\LogFTPMake.txt
echo.
echo.
echo.
echo %TIME%
echo Moving FTP Folders From - %SRC%
echo -----------------------To    - %DEST%
type %SRCLIST% | more
echo.
echo ...Ready?
pause
echo %PROGFTP% %SRC% %DEST%
:FTPENGINE
FOR /f "eol= delims=" %%i IN (%SRCLIST%) do (
    echo.
    echo Iteration Start Time - %TIME%
    echo Running the following command:
    echo ..Moving on FPT for %SRC%\%%i\%%i.i??
    echo %PROGFTP% %SRC% %DEST%
    echo ---------------------------------------
)
goto RESTART
:: FLASHFXP.EXE ftp://ftp.mozilla.org/; ftp://ftp.adobe.com/
::    Enqueue a download and then transfer the queue. Must use Site Manager (no ftp:// links).
::        flashfxp.exe -download <sitename> -remotepath="\ftp\folder\" -localpath="c:\path\newfolder\"
:: Enqueue a upload and then transfer the queue. Must use Site Manager (no ftp:// links).
::        flashfxp.exe -upload <sitename> -remotepath="\incoming\newfolder\" -localpath="c:\path\folder\"
:: Automatically begins transfer of file(s).
:: Example to download the file rfc959.txt to c:\my downloads\
::     flashfxp.exe -get -localpath="C:\My Downloads\" ftp://ftp.ripe.net/mirrors/rfc/rfc959.txt
:: Enqueue a delete command and then execute it on the server.
:: This can be combined with the -c2 or -quit switch to close FlashFXP after performing the command.
:: Example to delete a single file:
::        flashfxp.exe "\alpha\omega" -delete="\path\to\file.ext"
:: Example to delete a folder and all sub-folders within it:
::     flashfxp.exe "\alpha\omega" -delete="\path\to\delete\"
:: Rename a file or folder on the server.
:: Always use absolute paths when specifying the original and new name.
:: This can be combined with the -c2 or -quit switch to close FlashFXP after performing the command.
:: Example:
::        flashfxp.exe "\alpha\omega" -rename="/public/today.txt" -to="/public/yesterday.txt"
:: Move a file or folder on the server. (identical to -rename above).



::_______________________________________________________________________





:TEST
goto TEST%ARCHIVETYPE%

:TESTISO
set LOGISOTEST=%DEST%\LogISOTest.txt
echo.
echo.
echo.
echo Testing ISOs in %DEST%
echo.
%PROGZIP% t %DEST%\*.iso -r > %LOGISOTEST%
type %LOGISOTEST%
echo Completed Testing ISOs
pause
goto RESTART

:TESTZIP
set LOGZIPTEST=%DEST%\LogZIPTest.txt
echo.
echo.
echo.
echo Testing ZIPs in %DEST%\
echo.
echo Running %PROGZIP%
%PROGZIP% t %DEST%\*.zip -r > %LOGZIPTEST%
:: type %LOGZIPTEST%
echo Completed Testing ZIPs
pause
goto RESTART
::_______________________________________________________________________

:INFO

:: imgBurn:
    :: /FILESYSTEM "ISO9660 + UDF"
    :: /VOLUMELABEL_ISO9660 "ALL_CAPS"
    :: "D:\PORTABLE\Disk\ImgBurn_2.4.2.0.Portable\ImgBurnPortable.exe"

:: WINRAR:
    :: -r Recurse SubDirectories
    :: -v Verbose Mode
    :: -m5 Compression Quality (1-5)
    :: -v50000k Span Image Size
    :: -rr10 Recovery Record 1-10%

:: 7zip Command Line Syntax:
:: 7z <command> [<switch>...] <base_archive_name> [<arguments>...]
:: <arguments> ::= <switch> | <wildcard> | <filename> | <list_file>
:: <switch>::= <switch_symbol><switch_characters>[<option>]
:: <switch_symbol> ::= '/' | '-'
:: <list_file> ::= @{filename}

:: Options par2cmd:
::   -b<n>  : Set the Block-Count
:: -s<n>  : Set the Block-Size (Don't use both -b and -s)
::   -r<n>  : Level of Redundancy (%%)
::   -c<n>  : Recovery block count (Don't use both -r and -c)
::   -f<n>  : First Recovery-Block-Number
::   -u     : Uniform recovery file sizes
::   -l     : Limit size of recovery files (Don't use both -u and -l)
::   -n<n>  : Number of recovery files (Don't use both -n and -l)
::   -m<n>  : Memory (in MB) to use
::   -v [-v]: Be more verbose
::   -q [-q]: Be more quiet (-q -q gives silence)
::   --     : Treat all remaining CommandLine as filenames
::_______________________________________________________________________

:RESTART
goto MENU
set RESTART=
echo Restart?
set /p RESTART=
if "%RESTART%" == "y" goto MENU
goto EXIT
::_______________________________________________________________________

:ABORT
echo An Error Occurred
goto EXIT

:EXIT
echo Exiting...
pause
::     EXIT

:BITMAP
:: 00000000
:: 1 = PORTABLE APPS ( source_portable.txt)
:: 2 = NUCTOOLS (source_nuctools.txt)
:: 3 = GC SERVER(source_gcserver.txt)
:: 4 = GC IPT( source_gcipt.txt)
:: 5 = set /p custom source file
 

Tags