my $out = './data/IDs_created.txt';
open (OUT, ">>$out");
print "Enter ID: \n";
while (<>) {
print OUT "$_";
}
close OUT;
####
use warnings;
use Text::CSV;
use Encode;
$file = './data/IDS.csv'; #Default
#Parsing CSV
my $csv = Text::CSV ->new ({binary =>1, eol => $/});
open (CSV, '<:encoding(utf8)', $file) or die "Cannot open $file: $!\n";
open (OUT, '>:encoding(utf8)', './data/IDs_created.txt') or die "Kann Datei nicht öffnen: $!\n";
while (my $line = ) {
chomp $line;
if ($csv->parse($line)) {
my @fields = $csv->fields ();
chomp (@fields);
print OUT "@fields\n";
}
else {
warn "Line could not be parsed: $line\n";
}
}
print "CSV parsed and saved as text file: IDs_created.txt!";
close CSV;
close OUT;
####
#!/usr/bin/perl
#
#Script allows to search and copy files
#Thanks to Anonymous Monk
#Works only with PERL created text file!!!
#
#tested: --ok!
use strict;
use warnings;
use autodie;
use File::Find::Rule;
use File::Slurp;
use File::Basename;
use File::Copy;
my $startdir = shift or die Usage();
my $dirTarget = '/cygdrive/d/tmp/';
my $fnames = join '|', map quotemeta, read_file('./data/IDs_created.txt' , qw/ chomp 1 /);
my @fnames = find( file => name => qr{$fnames}, in => $startdir );
copy ($_, $dirTarget.basename ("$_")) for (@fnames);