I have a number of directories, all of which contain a file named "accepted_hits.bam". I'd like to rename each of those files as "accepted_hits_ID.bam", where ID corresponds to the directory name that the file is found within. For instance, the directories are named like so:
drwxr-xr-x 3 fr2259 ac_lab 249 Oct 4 04:33 0
drwxr-xr-x 4 fr2259 ac_lab 76 Oct 3 20:16 1
drwxr-xr-x 4 fr2259 ac_lab 76 Oct 3 20:29 10
drwxr-xr-x 4 fr2259 ac_lab 76 Oct 3 20:30 11
drwxr-xr-x 3 fr2259 ac_lab 249 Oct 3 20:03 12
drwxr-xr-x 4 fr2259 ac_lab 76 Oct 3 20:52 13
and I'd like the accepted_hits files to be named
accepted_hits_0.bam
accepted_hits_1.bam
etc.
I suspect that there's a clever way to do this on the command line, but so far I haven't proven that clever. Any help is appreciated.