Skip to content

Instantly share code, notes, and snippets.

@heralight
Last active December 26, 2017 13:56

Revisions

  1. heralight revised this gist Dec 26, 2017. No changes.
  2. heralight renamed this gist Dec 26, 2017. 1 changed file with 0 additions and 0 deletions.
  3. heralight revised this gist Dec 26, 2017. 1 changed file with 32 additions and 0 deletions.
    32 changes: 32 additions & 0 deletions Zip with yyyymmdd_FirstFile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    tabargs=( "$@" )

    firstFile="$1"
    directory=$(dirname "$1")
    cd "$directory"
    zipFileName=`basename "$firstFile"`
    DATE=`date '+%Y%m%d_%H%M%S'`
    zipFileName=${DATE}_${zipFileName}.zip
    echo $zipFileName
    echo $directory


    what=""

    function relpath() {
    python -c "import os,sys;print(os.path.relpath(*(sys.argv[1:])))" "$@";
    }


    for word in "${tabargs[@]}"; do what="${what} \"$(relpath "${word}")\""; done


    action="zip \"${zipFileName}\" \
    $what \
    -x */.DS_Store \
    -x */.git \
    -x */.svn \
    -x */.idea \
    -X */__MACOSX"

    echo $action
    eval $action
  4. heralight created this gist Dec 26, 2017.
    8 changes: 8 additions & 0 deletions keka extract to folder.ext.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    for f
    do
    echo "$f"
    dest="${f}.ext"
    cmd="/Applications/Keka.app/Contents/Resources/keka7z -y -o\"${dest}\" x \"${f}\""
    echo $cmd
    eval $cmd
    done