I have multiple layered sub-directories, and I am trying to relocate all directories which contain files of a pattern into a new parent directory. I want to maintain the contents of the directories I wish to move, whether or not they have files in addition to those matching a pattern.
For example:
homedir/subdir/{file.txt, file.png, file.rtf}
homedir/subdir/{file.txt, file.png}
homedir/subdir/{file.txt, file.jpg}
homedir/subdir/subdir/{file.png, file.png, file.mp3}
I want each DIRECTORY containing "*.png" (along with any additional non-png contents that may be within the directory) to be moved to /dirPNG
So, the result would be:
homedir/subdir/{file.txt, file.jpg}
homedir/dirPNG/subdir/{file.txt, file.png, file.rtf}
homedir/dirPNG/subdir/{file.txt, file.png}
homedir/dirPNG/subdir/subdir/{file.png, file.png, file.mp3}