I've been using Linux for a few years now, but I'm not very familiar with the console. I can manage simple copy commands, but now I have a requirement that is beyond my knowledge.
I have a large number of directories (folder1, folder2, folder3 etc.). In each of these directories there is a file with the same name (e.g. file.txt). I would now like to batch copy these files within the directories and use the names of the respective directory as the file name. The original files should remain unchanged.
So... 'folder1/file.txt' is to be copied to 'folder1/folder1.txt'.
This means that there should be two files with the same content in each directory, one of which has the same name as the directory.
I assume I need a bash script for the operation, right? And if so, what would this script look like?
I'd appreciate any help.
Harry