#!/bin/bash #Company: PowerCraft Technology #Author: Copyright Jelle de Jong #Note: Please send me an email if you enhanced this script #Version: 0.0.4 #Date: 28-11-06 / 10-02-07 / 2009-01-03 #System: Ubuntu/Debian GNU/Linux #Information: man zip #Category Thunar scripts (thunar->edit->custom actions) #Name: Create Archive #Description: Create a archive with from selected file(s) #Command: xfce4-terminal --disable-server --hide-toolbars --execute /usr/share/pct-thunar-scripts/scripts/create-archive %F #Patterns: * #Directories: True #Audio Files: True #Image Files: True #Text Files: True #Video Files: True #Other Files: True # Did the script work for you? # Yes # Yes, but with some errors # Yes, but I had to change some things # Not at all # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. TEXTDOMAINDIR=/usr/share/locale TEXTDOMAIN=${0##*/} NAME=$"Create Archive" DESCRIPTION=$"Create a archive with from selected file(s)" cecho() { case "$1" in "black") echo -ne "\E[30m" ;; "red") echo -ne "\E[31m" ;; "green") echo -ne "\E[32m" ;; "yellow") echo -ne "\E[33m" ;; "blue") echo -ne "\E[34m" ;; "magenta") echo -ne "\E[35m" ;; "cyan") echo -ne "\E[36m" ;; *) echo -ne "\E[30m" exit ;; esac echo "$2" "$3" tput sgr0 } cecho "green" $"program:" echo "$0" cecho "green" $"description:" echo "$DESCRIPTION" cecho "green" $"processing file(s):" for I in "$@" do file=${I##*/} echo "$file" done question() { cecho "green" $"choose a option and press enter" echo $"[1] creating zip archive" echo $"[2] creating compressed tar archive" echo $"[3] exit" cecho "green" $"option: " read option } unset option while [ -z "$option" ] do question done if [ "$option" = "3" ] then exit 0 fi cecho "green" $"enter current working directory: " echo "$PWD" cd "$PWD" for I in "$@" do dirname=${I%/*} file=${I##*/} filename=${I##*/}; filename=${filename%.*} extension=${I##*.} cecho "green" $"starting with: " echo "$file" query+=("$file") cecho "green" $"completed with: " echo "$file" cecho "cyan" "---------------" done if [ -n "$query" ] then if [ "$option" = "1" ] then echo $"staring zip command, please standby" cecho "green" $"creating archive: $filename.zip" echo $"command: zip -r -T $filename.zip ${query[@]}" zip -r -T "$filename".zip "${query[@]}" fi if [ "$option" = "2" ] then echo $"staring tar command, please standby" cecho "green" $"creating archive: $filename.tar.gz" echo $"command: tar --create --auto-compress --file $filename.tar.gz ${query[@]}" tar --create --auto-compress --file "$filename".tar.gz "${query[@]}" fi fi cecho "green" -n $"finished, please press the [enter] key to close and exit this window" read input exit 0