Thread Funktionen für Dateihandling gesucht (21 answers)
Opened by kami at 2010-03-28 13:06

kami
 2010-03-28 22:01
#135409 #135409
User since
2010-03-17
92 Artikel
BenutzerIn
[default_avatar]
Hi,

so ich habe das jetzt alles mal ein bißchen für mich angepasst. Mit normalen Ordnernamen geht es nur bei Leerzeichen Klappt es nicht mehr. Was kann ich tun?

Bis Line 24 klappt auch alles also die print ausgabe stimmt.

Leider weiß ich nicht wie ich den Tipp von pq einbinden soll. Ich bin leider nicht so ein großer PHP crack. Sorry wenn ich deswegen nochmal so doof frage.

Gruß kami

Code (perl): (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
#!/usr/bin/perl -w

use strict;
use warnings;
use Getopt::Long;

use File::Copy;
use File::Spec;
use File::Glob ':glob';

my ($source_path, $txt_check, $verzeichnis, $dest_path,$file); 
my %options = ();
GetOptions(\%options, 'txt=s');

my $downloaddir='/home/kami/download';
my $finaldir='/home/kami/final';

$verzeichnis=File::Spec->join($downloaddir, $options{'txt'});

# TXT Dateien suchen und kopieren

$txt_check=File::Spec->join($verzeichnis, '*.txt');
print $txt_check."\n";
if(glob($txt_check))
{ print "1"; 
for $source_path (bsd_glob($txt_check))  {
print $source_path."\n";
        if(-f $source_path)
         {   
           (undef,undef,$file) = File::Spec->splitpath( $source_path );
           
           $dest_path=$nfo_check=bsd_glob(File::Spec->join($finaldir, $file));
           print $dest_path."\n";
           copy($source_path,$dest_path) or die("ERROR copy($source_path,$dest_path) $!\n");
         }
       }
  }

View full thread Funktionen für Dateihandling gesucht