This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how I can extract files (.fna) that is in multiple folders with a for loop.

how I can extract files (.fna) that is in multiple folders with a for loop.

name folders : GCA_000009205.2, GCA_000009225.2, GCA_000009265.1, ...

each folder containing a file that ends with (.fna) in all folders : GCA_000009205.2_ASM920v2_genomic.fna, ...

genome sequence bash

Extract what? To where?

extracting an .fna file from multiple folders.

Hello abdeljalil.senhajirachik!

Please follow the advice you have already been given in one of your past threads : C: how I can download 2,333 genomes from the NCBI database ?

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

hello, It's the same question sir, I need to extract the files, not download them. Thank you for understanding.

You should have already downloaded the files if you followed the solution provided in that answer. If by extracting you mean copying all the .fna files out of individual folders into one location then you have the template to do so in the comment linked above. All you need to do is add a cp ${fa_file} to_somewhere (you get the idea).

It is not that we can't give you a ready to use solution but if you don't try things out on your own you will not learn these basic skills.

All right, thanks, but I tried several times before I asked the question. thanks

for fa_file in ncbi_dataset/data/GC*/*.fna ; do cp ${fa_file} to_somewhere; done

If you don't want to duplicate the data, use mv instead of cp.

0 answers

No answers yet.

Log in to answer this question.