Skip to main content
All CollectionsTeraCopy for WindowsFAQ
How to Automatically Zip, Split, and Transfer Files
How to Automatically Zip, Split, and Transfer Files
Updated over 3 months ago

If you need to copy many small files over a network, it can take a long time even with multi-thread copying. This guide will show you how to add an entry to the TeraCopy drag-and-drop confirmation dialog for a batch file that will:

  • Launch 7-Zip to compress and split files into 10 GB volumes.

  • Use TeraCopy to copy the archive(s) to the target folder.

Save this code to the 7zipCopy.bat file:

@echo off
setlocal enabledelayedexpansion

REM Check if the correct number of arguments is provided
if "%~1"=="" (
echo Usage: 7zipCopy.bat input_file.txt temp_folder target
echo 1. 7-Zip will pack files listed in 'input_file.txt' to 'temp_folder'.
echo 2. TeraCopy will copy 'temp_folder' to 'target'.
exit /b 1
)

REM Set variables
set input_file=%~1
set outputDir=%~2
set target_path=%~3
set output_file=output_paths.txt
set zip_prefix=archive

REM Check if the input file exists
if not exist "%input_file%" (
echo Input file not found: %input_file%
exit /b 1
)

REM Check if the temp folder exists
if not exist "%outputDir%" (
echo Temp folder not found: %outputDir%
exit /b 1
)

REM Ask user whether to clear the temp folder
echo Temp folder: %outputDir%
set /p clear_temp=Delete all files in this folder (Y/N)?

if /i "!clear_temp!"=="Y" (
echo Clearing temp folder...
del /q "%outputDir%\*"
if %errorlevel% neq 0 (
echo Failed to clear the folder.
exit /b 1
)
echo Temp folder cleared.
) else (
echo Temp folder not cleared.
)

REM Initialize the zip file name
set zipFileName=%outputDir%\%zip_prefix%.zip

REM Store files with no compression (-mx0) in 10 GB volumes (-v10g)
"C:\Program Files\7-Zip\7z.exe" a -tzip -mx0 -v10g "%zipFileName%" "@%input_file%" -bb

if errorlevel 1 (
echo Compression failed.
pause
exit /b 1
)

"C:\Program Files\TeraCopy\TeraCopy.exe" copy "%outputDir%" "%target_path%"

Press Win+R, type %APPDATA%\TeraCopy and press Enter.

Add this text to the end of PasteMenu.ini file:

[5]
title=7zip + Copy
path=cmd.exe
parameters=/K C:\Your\Path\7zipCopy.bat "{list}" "C:\Temp\Archive "{target}"

Replace C:\Temp\Archive with any existing empty folder.

After the copy, you can unpack the archive(s) on the destination machine.

Did this answer your question?