I've spent ages trying to build this and had a good look around for a way to do it. I have a directory tree which contains a set of folders and files. Some of the folders contain more than one file but most contain only a single one.
I'm trying to move all of the files which are on their own in directories one level below the root into the root. E.g:
- Root is: /volume3
- Single file in a sub folder: /volume3/20110103/20110103.log
- File should end up as: /volume3/20110103.log
I know how to flatten the entire structure fairly easily but its the conditional part which I can't figure out how to do. Can anyone help?