From be91088d677e0cfea58b122539ba14b32e6a2d5a Mon Sep 17 00:00:00 2001 From: JoseluCross Date: Sat, 2 Jul 2016 18:21:17 +0200 Subject: [PATCH] add listing mode to jkazip --- jka-toolkit/jkazip | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/jka-toolkit/jkazip b/jka-toolkit/jkazip index 92b5a23..4c7a31f 100755 --- a/jka-toolkit/jkazip +++ b/jka-toolkit/jkazip @@ -2,7 +2,6 @@ #JKA - ZIP #A script for de/compress files and folders in many formats #Author: JKA Network - contacto@jkanetwork.com -#Function decompress(); decompress the file whith the format especified # gettext initialization export TEXTDOMAIN='jkazip' @@ -40,7 +39,7 @@ function msg2() { echo } -version="2.0.3" +version="2.3.0" if [ -z "$1" ];then echo "$(gettext "No option specified, use jkazip -h")" > /dev/stderr elif [ "$1" = "-h" ];then @@ -48,6 +47,7 @@ elif [ "$1" = "-h" ];then echo "" echo "$(gettext " -d, decompress file")" echo "$(gettext " -c , compress file")" + echo "$(gettext " -l, list all files")" echo "$(gettext " -h, show help box and exit")" echo "$(gettext " -v, show version and exit")" echo "" @@ -178,6 +178,38 @@ elif [ "$1" = "-c" ];then echo > /dev/stderr ;; esac +elif [ "$1" = "-l" ];then + if [ -z "$2" ];then + echo "$(gettext "No file or directory specified")" > /dev/stderr + exit + fi + sacaFormato $2 + case $formato in + "tar" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "tgz" | "tbz2" | "txz" | "tlz") + tar taf "$2" + ;; + "7z") + 7z l "$2" + ;; + "zip") + zip -v "$2" + "gz" ) + gzip -l "$2" + ;; + "xz") + xz -l "$2" + ;; + "bz2" | "lz" ) + echo "Not supported for listing" > /dev/stderr + ;; + "rar") + unrar v "$2" + ;; + *) + printf -- "$(gettext "File extension %s are not supported")" $formato > /dev/stderr + echo > /dev/stderr + ;; + esac else echo "$(gettext "Unknown option")" > /dev/stderr fi