Skip to content
Snippets Groups Projects
isabelle-prepare-directory.sh 789 B
Newer Older
  • Learn to ignore specific revisions
  • Andreas Schärtl's avatar
    Andreas Schärtl committed
    #! /bin/sh
    
    set -eu
    
    # Prepare DIRECTORY for import w/ the GraphDB web interface.
    #
    # That is, it searches for *.rdf.xz files in DIRECTORY and passes
    # each file to the isabelle-prepare-file.sh script.
    #
    # If you want to prepare Isabelle exported files for GraphDB, you
    # probably should use this script.
    
    if [ ! $# -eq 1 ]; then
        echo "usage: $0 DIRECTORY" 1>&2
        exit 1
    fi
    
    
    directory="$(realpath "$1")"
    threads=8
    
    Andreas Schärtl's avatar
    Andreas Schärtl committed
    
    script_dir=$(dirname "$0")
    cd "$script_dir"
    
    
    # Recurse in $directory and pass each found item to
    # isabelle-prepare-file.sh. We use xargs(1) to seep this up by
    # exploiting parallelism.
    #
    # We also run it with niceness 15 as to not annoy other CIP users.
    find "$directory" -name "*.rdf.xz" -print0 | nice -n 15 xargs -0 -P $threads -I {} ./isabelle-prepare-file.sh {}