From 1203f478c03ebcb80b57da280282aa39f9e86267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas.schaertl@fau.de> Date: Mon, 27 Apr 2020 14:31:24 +0200 Subject: [PATCH] add xz-to-gz script - converts .xz files to .gz recursively - graphdb wants .gz files; so there we go --- ulo/xz-to-gz.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 ulo/xz-to-gz.sh diff --git a/ulo/xz-to-gz.sh b/ulo/xz-to-gz.sh new file mode 100755 index 0000000..668dd51 --- /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 -- GitLab