diff --git a/ulo/xz-to-gz.sh b/ulo/xz-to-gz.sh new file mode 100755 index 0000000000000000000000000000000000000000..668dd51c2e258891767f766fc1163a2c45121d9a --- /dev/null +++ b/ulo/xz-to-gz.sh @@ -0,0 +1,26 @@ +#! /bin/sh + +# given a path, traverse that file system tree and extract all +# .xz files and re-compress them to .gz; some tooling, in particular +# graphdb, only supports gz and not xz + +set -eu + +if [ ! $# -eq 1 ]; then + echo "usage: $0 DIRECTORY" 1>&2 + exit 1 +fi + +directory="$1" +files=$(find "$directory" -name "*.xz") + +for file in $files; do + echo "$file" 1>&2 + + # the filename of the extracted (uncompressed) file + rdf_file=$(echo "$file" | sed 's/\.xz//') + + # uncompress and then compress again + unxz "$file" + gzip "$rdf_file" +done