in the source directory, i have some binary files named 1.bin, 2.bin, 3.bin, etc. In the dest directory, i have the same named binary files, but with different content. I need to append the contents of the dest directory to the files with the same name, in the source directory, but also be sure that the content of the destination directory will be added below the content of the source directory. This is where i have come:
#!/usr/bin/perl
$source_dir = "/data/source_dir";
$dest_dir = "/data/dest_dir";
opendir ($source, $source_dir);
@source_files = readdir $source;
foreach $each_file (@source_files){
if($each !~ /^(\.|\.\.)$/) {
open $file_h , "< $source_dir/$each_file";
@contents = <$file_h>;
open $dest_file, ">>$dest_dir/$each_file";
print $dest_file @contents;
@contents =();
}
}
How can i be sure that 1.bin from dest directory is appended - merged under the content of the source directory?
How then the code should look like?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)