Skip to content

Instantly share code, notes, and snippets.

@Golumpa
Last active June 18, 2026 12:54
Show Gist options
  • Select an option

  • Save Golumpa/89e3d3eeb810d7f8f539b61cffe5b29b to your computer and use it in GitHub Desktop.

Select an option

Save Golumpa/89e3d3eeb810d7f8f539b61cffe5b29b to your computer and use it in GitHub Desktop.
#!/bin/bash
# This simple bash script adds a CRC32 to the end of every file in a chosen folder. It will not add them recursively.
# This script needs libarchive-zip-perl (Debian based), perl-Archive-Zip (Red Hat based) installed to be able to run.
# Change this to the folder that have files you want to add CRC32's to.
home="FolderName"
# This filters out those files you want to add a CRC32 to.
ext="mkv"
while read a; do
i=`basename "${a}"`;
crc=`crc32 "${home}/${i}" | awk '{print toupper($0)}'`;
mv "${home}/${i}" "${home}/${i%%.*} [${crc}].${ext}";
done < <(find "${home}/" -type f -name \*.${ext})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment