Entering edit mode
                    2.9 years ago
        sharmatina189059
        
    
        ▴
    
    110
    for FILE in home/tinas/MAGs_12_example_data/12_MAGs_seq.fna/dir_extension_checkm/tina/prokka_annotation/**/*.gff
do
        cp $FILE /home/tinas/MAGs_12_example_data/12_MAGs_seq.fna/dir_extension_checkm/tina/prokka_annotation/all_gff_file/
done
This command is working fine in terminal but in bash script this shows No such file or directory. Can anybody help me out with this command?
Hi, not sure why this loop is necessary. cp can copy multiple files at once.
cp /home/.../*.gff /home/.../destinationworks, note you are lacking a single "/" in your source dir.After you have run this for the first time, if you run it again, you will get an error that you are trying to copy a file onto itself.
I tried
cp **/*.gff /home/tinas/MAGs_12_example_data/12_MAGs_seq.fna/dir_extension_checkm/tina/prokka_annotation/all_gff_file/in bash script but it was not working.cp */*.gffotherwise you will copy the hidden file.gff