%mFastaMerger_ShortcutPrinter.m  by Ali Mokdad

%This program will print out a line (without actually executing its commands)
%This line will contain commands that will allow you, if you copy/paste it in the command window,
%to merge all the files inside the directory specified by "Directories" at the beginning of the program.

clear
clc;
tic
%Files in the following directories will be renamed
Directories = {'Sept2004_Alignments_Separate\23S\A',...
    'Sept2004_Alignments_Separate\23S\B',...
    'Sept2004_Alignments_Separate\23S\E',...
    'Sept2004_Alignments_Separate\16S\A',...
    'Sept2004_Alignments_Separate\16S\B',...
    'Sept2004_Alignments_Separate\16S\E'};

%system('copy/B file1.txt +file2.txt file3.txt');
%system('copy/B 23sA_UNIQUE_25.fasta.txt +23sB_UNIQUE_184.fasta +23sE_UNIQUE_137.fasta 23S_ABE_2004_UNIQUE.fasta');

for Direct=1:length(Directories)
    cd(Directories{Direct})

    FastaFileIN = ls;
    if size(FastaFileIN)>2
        fprintf('%s ','system(''copy/B');
        fprintf('%s ',FastaFileIN(3,:));

        for f=4:size(FastaFileIN)
            fprintf('%s%s ','+',FastaFileIN(f,:));
        end
        fprintf('%s%g%s\n','MergedFile',Direct,'.fasta'');');
    else fprintf('%s\n','No files to merge in this directory');
    end
%   pause

    cd ..,    cd ..,    cd ..

end
fprintf('\n');
toc

