Hier nochwas zum Packen:
/opt/kde2/share/apps/konqueror/servicetypes/packer.desktop
Code:
[Desktop Entry]
ServiceTypes=allfiles
Actions=Pack
[Desktop Action Pack]
Name=Packen...
Exec=xterm -e /usr/local/bin/pack %U
und das script /usr/local/bin/pack(ich weiss 5 Zeilen Shell hättens auch irgendwie getan):
Code:
zu 2)
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use File::Basename;
use Tk;
my $all_files;
my $execute = 0;
my $ArchivName = "NeuesArchiv.tgz";
my $force = 0;
my $error;
$all_files .= "$_ " for (@ARGV);
my $window = Tk::MainWindow->new( -title => "Dateien Packen" );
my $frame1 = $window
->Frame
->pack();
my $label = $frame1
->Label( -text => "Archivname:" )
->pack( -side => "left" );
my $entry = $frame1
->Entry( -textvariable => \$ArchivName )
->pack();
my $frame2 = $window
->Frame
->pack( -pady => 5 );
my $ok = $frame2
->Button( -text => "OK", -command => \&check )
->pack( -side => "left" );
my $cancel = $frame2
->Button( -text => "Abbrechen", -command => sub { exit } )
->pack();
my $status = $window
->Label()
->pack();
MainLoop;
sub check {
if ( -f $ArchivName && $force < 1 ) {
$status ->configure( -text => "Datei schon vorhanden!",
-foreground => "darkred");
$ok ->configure( -text => "Trotzdem!" );
$force++;
}
else {
$error = 0;
if (
system( "tar -cvzf " . dirname( $ARGV[0] ) . "/$ArchivName $all_files")
)
{
$status ->configure( -text => "Fehler: $!",
-foreground => "darkred");
$ok ->configure( -text => "Na und!" );
$cancel ->configure( -text => "ich hör lieber auf..." );
}
else {
$status ->configure( -text => "Alles OK",
-foreground => "darkgreen");
$cancel ->configure( -text => "Beenden" );
$ok ->configure( -text => "Nochmal ;-)" );
}
}
}
Lesezeichen