Bash Rename Specific File to Directory Name
This is helpful when you have many different directories say something like
-dir1 --metafile.txt -dir2 --metafile.txt
In this case the directory names are different, but the underlying filenames are the same because in actuality you want to join them all together most likely or they were produced by splitting a larger file into directories.
This script will get the files in the subdirectories name metafile.txt and rename them to the subdirectory plus txt extension at the subdirectory level
for subdir in *; do mv $subdir/metafile.txt $subdir.txt; done;