I want to rename all files within a directory to match the parent folder's name.
Now I've found several results that sort of do what I want, but they all seem to rely on a static filetype, path, format, etc.
I need one that takes any crazy folder name and applies it to any files within, leaving their extension unchanged. I don't want the Parent's Parent's Parent, etc. Just something I can run in a current folder to affect all sub-folders within that folder.
For example:
Folder structure
This.Is.A.Crazy.Name.S00E00.720p
|
| asdfasdfasdfasdfasdfasdfafs.mkv
|
| info.nfo
|
| proof.jpg
|
You.See.Where.This.Is.Going.14x01.480p.crappo
|
| video.mp4
Expected result
This.Is.A.Crazy.Name.S00E00.720p
|
|_This.Is.A.Crazy.Name.S00E00.720p.mkv
|
|_This.Is.A.Crazy.Name.S00E00.720p.nfo
|
|_This.Is.A.Crazy.Name.S00E00.720p.jpg
|
You.See.Where.This.Is.Going.14x01.480p.crappo
|
| You.See.Where.This.Is.Going.14x01.480p.crappo.mp4
Could anyone advise how this can be done in a script or a single, long command?