I have a deeply nested folder structure in which there are hundreds of files called data.log
. I need a script to rename each of these data.log
files according to the name of the parent folder they are in and then move the renamed filed to a defined target folder. The original data.log
files should remain in place.
Example:
The file /opt/slm/data/system/amd-823723/data.log
needs to be renamed to amd-823723
and then moved to /opt/slm/output/
, whereby the original data.log
file remains in place.
/opt/slm/data/system
?/opt/slm/data
? Something else? Will all the new files be in/opt/slm/output/
?