Thread Wie soll ich diesen Shell-Code pogrammieren?
(13 answers)
Opened by trojax at 2009-05-14 09:10
ungetestet:
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 #!/usr/bin/perl use strict; use warnings; use File::Copy; my $version=4; my $destination_dir='.'; my $source_dir='../ordner'; # Dateien kopieren opendir(my $dirh, $source_dir) or die "Error open $source_dir ($!)\n"; while(my $file=readdir($dirh)) { # wenn die Endung stimmt if($file=~/\.cvs\.(\d+)$/ && $1 == $version-1) { my $source="$source_dir/$file"; my $dest="$destination_dir/$file"; # Punkt und Zahl am Ende entfernen $dest=~s/\.\d+$//; # Datei kopieren. print "$source -> $dest\n"; copy($sorce,$dest) or die "Error copy $source -> $dest ($!)\n"; } } closedir($dirh); Last edited: 2009-05-14 10:12:57 +0200 (CEST) |