#!/usr/bin/perl use strict; use warnings; use Getopt::Long; use File::Copy; use File::Spec; use File::Glob ':glob'; my $test=''; my $testdir='/home/kami/test'; my $test2dir='/home/kami/test2'; my $infofile='/home/kami/scripts/test.txt'; GetOptions( 'test=s' => \$test, 'source_dir=s'=> \$testdir, 'dest_dir=s' => \$test2dir, 'info_file=s' => \$infofile, ) or die("unbekannte Option!"); my $verzeichnis=File::Spec->join($downloaddir, $test); my $test_check=File::Spec->join($testdir, '*.test'); for $source_path (bsd_glob($test_check)) { if(-f $source_path) { my (undef,undef,$file) = File::Spec->splitpath( $source_path ); my $dest_path=File::Spec->join($test2dir, $file); warn "oeffne jetzt die datei $file2"; open(my $fh, '>>' $infofile) or die "unable to open $infofile $!"; print $fh $source_path." ==> ".$dest_path."\n"; close($fh); move($source_path,$dest_path) or die("ERROR move($source_path,$dest_path) $!\n"); } }