#!/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"); } } }