Looping through directories and running .txt files into a program
Posted on 2011-10-24
I currently have .txt files saved in different folders in one directory.
I'm now trying to create a shell script which will run through my directory, go through all the folders and if there is a text file containing the word "FASTA" (all capitals) in the directory, it will run the following code:
formatdb -i input_textfilenameFASTA.txt -n output_nameDATABASE
The program turns the textfile into a database and creates three files: .phr , .psq and .pin
Therefore, say the shell script opens the first folder and comes across a text file with FASTA in the name:
therefore, the script would do the following:
formatdb -i file1FASTA.txt -n file1DATABASE
it would then put the database files in the same directory as the text file. If there are any more text files in the directory, it would then do the same with these. If there are no more files in the directory it would then move on to the next directory.
Would it be possible to achieve this through Shell scripting?