Schrift
[thread]3590[/thread]

Script soll unterverzeichnisse öffnen



<< >> 2 Einträge, 1 Seite
Gast Gast
 2005-07-09 19:03
#33369 #33369
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#! /usr/bin/perl 

### mp3 and wma to ogg by darklinux presents
###no warrenty

use warnings;
use File::Find ();


$dir=`pwd`;

chomp($dir);

opendir(CHECKDIR,"$dir");

while ($file=readdir(CHECKDIR)) {
$orig_file=$file;

if($orig_file =~ m/\.mp3$/i)
{
print "Checking file: $orig_file\n";
$new_wav_file=$orig_file;$new_wav_file=~s/\.mp3/\.wav/;
$new_ogg_file=$orig_file;$new_ogg_file=~s/\.mp3/\.ogg/;
$convert_to_wav="mplayer \"./$orig_file\" -ao pcm -aofile \"./$new_wav_file\"";
$convert_to_ogg="oggenc -q 4 \"./$new_wav_file\" \"./$new_ogg_file\"";
$remove_wav="rm -rf \"./$new_wav_file\"";
$remove_mp3="rm -rf \"./$orig_file\"";
print "EXEC 1: $convert_to_wav\n";
$cmd=`$convert_to_wav`;
print "EXEC 2: $convert_to_ogg\n";
$cmd=`$convert_to_ogg`;
print "REMOVE WAV: $remove_wav\n";
$cmd=`$remove_wav`;
print "REMOVE MP3: $remove_mp3\n";
$cmd=`$remove_mp3`;
print "\n\n";
}

elsif($orig_file =~ m/\.wma$/i)
{
print "Checking file: $orig_file\n";
$new_wav_file=$orig_file;$new_wav_file=~s/\.wma/\.wav/;
$new_ogg_file=$orig_file;$new_ogg_file=~s/\.wma/\.ogg/;
$convert_to_wav="mplayer \"./$orig_file\" -ao pcm -aofile \"./$new_wav_file\"";
$convert_to_ogg="oggenc -q5 \"./$new_wav_file\" \"./$new_ogg_file\"";
$remove_wav="rm -rf \"./$new_wav_file\"";
$remove_wma="rm -rf \"./$orig_file\"";
print "EXEC 1: $convert_to_wav\n";
$cmd=`$convert_to_wav`;
print "EXEC 2: $convert_to_ogg\n";
$cmd=`$convert_to_ogg`;
print "REMOVE WAV: $remove_wav\n";
$cmd=`$remove_wav`;
print "REMOVE WMA: $remove_wma\n";
$cmd=`$remove_wma`;
print "\n\n";
}

elsif ($orig_file =~ m/\.mpc$/i)
{
print "Checking file: $orig_file\n";
$new_wav_file=$orig_file;$new_wav_file=~s/\.mpc/\.wav/;
$new_ogg_file=$orig_file;$new_ogg_file=~s/\.mpc/\.ogg/;
$convert_to_wav="mppdec \"./$orig_file\" \"./$new_wav_file\"";
$convert_to_ogg="oggenc -q5 \"./$new_wav_file\" \"./$new_ogg_file\"";
$remove_wav="rm -rf \"./$new_wav_file\"";
$remove_mpc="rm -rf \"./$orig_file\"";
print "EXEC 1: $convert_to_wav\n";
$cmd=`$convert_to_wav`;
print "EXEC 2: $convert_to_ogg\n";
$cmd=`$convert_to_ogg`;
print "REMOVE WAV: $remove_wav\n";
$cmd=`$remove_wav`;
print "REMOVE MPC: $remove_mpc\n";
$cmd=`$remove_mpc`;
print "\n\n";
}
}

use Qt;

my $a = Qt::Application(\@ARGV);
my $quit = Qt::PushButton("Fertig", undef);
$quit->resize(100, 30);
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
$a->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
$a->setMainWidget($quit);
$quit->show;
exit $a->exec;


nun möchte ich gerne wissen wie ich es anstellen kann das s,das script unterordner öffnet.
betterworld
 2005-07-09 19:55
#33370 #33370
User since
2003-08-21
2614 Artikel
ModeratorIn

user image
OK, fuer die Code-Tags bekommst Du ein Plus. Aber ansonsten benutze bitte strict und poste bitte nur die relevanten Teile von Deinem Script.

Was genau ist denn Dein Problem? Wie man Verzeichnisse ausliest, weisst Du ja anscheinend. Wenn Du nun Rekursion einbauen willst, solltest Du vielleicht IO::Dir statt der großbuchstabigen Filehandles verwenden.\n\n

<!--EDIT|betterworld|1120925481-->
<< >> 2 Einträge, 1 Seite



View all threads created 2005-07-09 19:03.