Batch Files
Copies files, in folder order, into numbered batch folders (Batch_0001, Batch_0002 …) that each hold at most a set number of files and/or a set size, with every copy verified.
Batch Files splits a collection into smaller folders for upload, review assignment or transfer. Files are taken in natural folder order and copied into the current batch until adding the next file would pass the file limit or the size limit; then a new batch starts. The input is read only and never changed.
The batches are counted before anything is copied. If the batch numbers would not fit in the chosen number of digits, the run stops with nothing copied and says how many digits are needed. Each copy is checked by MD5, and the files keep their created, modified and accessed dates. Running again on the same files gives the same batches and names.
Use it when
- A review platform or transfer service limits the number or size of files per upload.
- You need to split a set of documents into equal-sized review batches.
- You need to copy a large collection onto several drives or media of fixed size.
How to run it
- Choose the folder of files as Input and an Output folder outside it.
- Set Max files per batch and/or Max batch size (GB); at least one must be more than 0.
- Set the Batch name prefix and Digits for the folder names.
- Decide whether to tick Keep sub-folders.
- Click Run.
- Click Open report, and open
batches.csvin the run folder for the per-batch totals.
Settings
Every setting has the same help beside it in the app. On the command line, pass each as --name value; ltk help batch-files lists them.
Settings
| Setting | What it does | Type and default |
|---|---|---|
Max files per batch--max-files |
Most files in one batch. 0 means no file limit (then a size limit is needed). 0 means no file limit, in which case a size limit is needed. With both limits set, a batch closes at whichever is reached first. |
number1000 |
Max batch size (GB)--max-size-gb |
Largest total size of one batch in GB (decimals allowed, e.g. 4.5 or 4,5; no thousands separators). 0 means no size limit (then a file limit is needed). A single file larger than this gets a batch of its own. Decimals may use a point or a comma (4.5 or 4,5). Do not use thousands separators: a value such as 1,000 is refused as ambiguous. A GB here is 1,024 × 1,024 × 1,024 bytes. A file larger than the limit gets a batch of its own, and a note lists such files. |
text5 |
Batch name prefix--prefix |
Start of each batch folder's name: Batch_ gives Batch_0001, Batch_0002… Must be usable in a folder name. It may be empty, giving folders named just by number. |
textBatch_ |
Digits--digits |
Digits in the batch number (4 gives 0001). If more batches are needed than fit, the run stops before copying anything and says how many digits are needed. Between 1 and 9. 4 allows up to 9,999 batches. |
number4 |
Keep sub-folders--keep-folders |
Off (default): files sit directly in their batch folder (clashing names are numbered, never overwritten). On: each file keeps its source sub-folder path inside its batch. Off: every file sits directly in its batch folder; if two files have the same name, the later one is numbered rather than overwriting, and the Note column says what it was saved as. On: each file keeps its source sub-folder path inside its batch, which avoids most clashes. |
yes/nofalse |
Common settings
| Setting | What it does | Type and default |
|---|---|---|
Input required--input |
Folder (or single file) to read. It is opened read-only and never modified. | folder empty |
Output required--output |
Folder for reports. Must not be inside the input folder. Each run gets its own sub-folder. | folder empty |
Recurse--recurse |
Include sub-folders. | yes/notrue |
Extensions--extensions |
Only process these extensions (e.g. .pdf, .docx). Empty means the tool's default set. | list empty |
Parallelism--parallelism |
Files processed at once. Use 1-2 for spinning disks or network shares. | number4 |
What you get
Each run creates its own folder inside the output folder, with the report batch-files.csv, errors.csv and manifest.json (see Run folders and manifests).
files\Batch_0001\…: The batch folders with the copied files.batch-files.csv: One row per file: Batch, original RelativePath, SizeBytes, NewPath within the files folder, Renamed (true if saved under a different name), MD5, Verification and Note.batches.csv: One row per batch: file count, total bytes, and how many files were copied and failed.
Report columns
BatchRelativePathFileNameSizeBytesStatusNewPathRenamedMD5VerificationNoteCreatedUtcModifiedUtcSourcePathDestinationPath
Check the result
- Open
batches.csvand confirm the number of batches and their sizes look right. - Look for Renamed = true and read the Note column.
- Check
errors.csv: a file that could not be copied leaves its batch smaller than planned, and a note says how many failed.
- Names ending in a dot or space, which Windows cannot create, are saved ending in
_instead; the row says so. - Sort or rename folders before running if the batch order matters, because files are batched in natural folder order.
- Batching is by count and size only. The tool does not know about document families, so an email and its attachments can end up in different batches if a batch boundary falls between them.
- The output needs as much free space as the files being batched, because everything is copied.
From the command line
The command line is part of LitTechKit Pro. See Command line.
ltk run batch-files --input "D:\Matter\ForUpload" --output "D:\Matter\Batches" --max-files 1000 --max-size-gb 4.5 --prefix Batch_ --digits 4
Related tools
- Copy Folder: Copies a whole folder tree (including empty folders) to the output with hash verification of every file, preserved timestamps, multi-threaded copying and automatic retries. Replaces Robocopy.
- File Inventory: Lists every file with size, timestamps, attributes, hashes and detected file type, flagging extensions that don't match the content.
- Assign Document IDs: Renames files to document IDs in folder order: prefix + number (ABC0000001) or prefix/box/folder/page (ABC.5000.0001.0001), one number per document or per page. Report maps each ID to the original path and MD5. Copies by default, renames in place on request, or just previews.