Renaming subfiles with parent folder name

Finally, i was able to figure out how to rename contigs.fasta files that were generated by SPades with parent_file_name_contigs.fasta

find . -type f -name “*contigs.fasta” -printf “/%P\n” | while read FILE ; do DIR=$(dirname “$FILE” ); mv .”$FILE” .”$DIR””$DIR”_contigs.fasta;done