Hi All,
I’m looking for a way of finding out when there are child directories (however deep) which have only one folder and bringing them up one, (e.g. to save double clicking as well as reduce chance of >256 path name).
So I would like to basically identify when I have
Parent\Subfolder1\Subfolder2\subfolder3\test1.jpg
or
Parent\subfolder4\subfolder5\test2.jpg
and in those cases then pick the name of the lowest subfolder, bring it up to the top and delete the others
ending up with
Parent\subfolder3\test1.jpg
parent\subfolder5\test2.jpg
I know it sounds greedy to be adding this also to the question but…
In the case where you have
Parent\foo1\foo2\foo3\test1.jpg
Parent\foo1\foo2\foo3\test2.jpg
Parent\foo1\foo2\foo4\test3.jpg
then I would like to end up with
Parent\foo1\foo3\test1.jpg
Parent\foo1\foo3\test2.jpg
Parent\foo1\foo4.test3.jpg
Does this make sense? I’ve been trying it with a script but I end up tying myself a little into knots with nested ifs and repeated logic… where it feels like it could be more easily solved by doing some sort of recursive “uplevel” function which would start at the deepest level of the tree and keep stepping backwards until it has cleaned all the useless directories.
Thanks,
Gavin
PS: I’m not expecting someone to do all the work for me… I won’t really learn that way, but if you know how to solve the problem and can give me a few hints and tips I’ll try to work it out myself and then post the answer back!