VText Provenance Checksum and File Size Tool
Purpose
This Windows batch script helps staff update the dc.description.provenance field in VText after uploading the finalized access PDF with the cover page.
It does the following:
- accepts a drag-and-drop PDF input
- calculates the file size in bytes
- calculates the MD5 checksum
- builds the file-specific provenance line
- copies that line to the clipboard
Download
Typical Local Use
- Copy the script to the workstation desktop or another easy-to-reach location.
- Drag and drop the finalized access PDF onto the batch file.
- Copy the generated line into the item provenance statement in VText.
- Update the item metadata after the finalized PDF has been uploaded.
Example Output
Full provenance example:
Made available in DSpace on 2026-04-14T14:45:48Z (GMT). No. of bitstreams: 1 ca-013-001-002-001_hahira-gold-leaf_1973-01-04a.pdf: 10513543 bytes, checksum: 4df6a4e411f1eef30ba5218b5f0d9147 (MD5) Previous issue date: 1973-01-04
Clipboard-ready line produced by the script:
ca-013-001-002-001_hahira-gold-leaf_1973-01-04a.pdf: 10513543 bytes, checksum: 4df6a4e411f1eef30ba5218b5f0d9147 (MD5)
Notes for Other Archives
- This script is designed for Windows workstations.
- It relies on
certutilfor the MD5 checksum andclipfor clipboard copy. - The output format can be adapted to other repository provenance patterns.
- If your local workflow uses SHA-256 or a different metadata field, adjust the script accordingly.
Script Source
@echo off
setlocal enabledelayedexpansion
if "%~1"=="" (
echo Drag and drop a finalized PDF file onto this tool.
pause
exit /b
)
set "FILE=%~1"
set "NAME=%~nx1"
set "SIZE=%~z1"
for /f "tokens=1" %%A in ('certutil -hashfile "%FILE%" MD5 ^| findstr /r /v "hash CertUtil"') do (
set "HASH=%%A"
)
set "LINE=%NAME%: %SIZE% bytes, checksum: %HASH% (MD5)"
echo.
echo ===================== IMPORTANT =====================
echo Only replace the checksum line in DSpace.
echo Do NOT overwrite the full provenance field.
echo.
echo Replace the line AFTER:
echo "No. of bitstreams: 1"
echo And BEFORE:
echo "Previous issue date"
echo =====================================================
echo.
echo Copy this line into DSpace:
echo.
echo %LINE%
echo.
:: Copy to clipboard
echo %LINE% | clip
echo [Copied to clipboard]
echo.
pause