I don't have a vbscript or one that Opus readily uses for you.
If the problem is as you'd describe it, I'd solve it a different way. In my opinion, there are better tools for this job. If you need to physically select files with the mouse, you'll have to write a script.
I would do it like this (the end product):
for i in $(find . -name '*.pdf' | sed 's-^\./\([^/][^/]*\)/.*$-\1-'); do echo mv $i NEW/$i; done
I'm doing using the Cygwin environment, which is a collection of the standard GNU, etc. tools that come on modern *nix platforms. I do it this way because the problem for me is easily broken down into simple parts, which are described as:
- get a list of all directories under a tree that have .pdf files
- modify that list to consist of the containing directories under the highest level parent directory
- move each of those directories into the NEW directory
This can be done other ways (even from within Opus using in perl script, vbscript, etc.), but I find this more cumbersome because testing each step is cumbersome. By using a command shell environment, each piece can be built upon the other, and tested very quickly. It took less than 1 minute to write and test the above. And to me the rapid testing/validation is the important part.
In case you are interested, the above parts are:
- Find all pdf files, printing out their relative paths:
$ find . -name '*.pdf'
./five/manual.pdf
./four/subdir/manual.pdf
./one/manual.pdf
./two/manual.pdf
- Take that output and strip out stuff below highest level directory below parent
$ ... | sed 's-^\./\([^/][^/]*\)/.*$-\1-'
five
four
one
two
- Wrap this output now into a loop, and iterate over each resulting directory
$ for i in $(find . -name '*.pdf' | sed 's-^\./\([^/][^/]*\)/.*$-\1-'); do echo mv $i NEW/$i; done
mv five NEW/five
mv four NEW/four
mv one NEW/one
mv two NEW/two
Above I just printed out (w/echo) what would be done, so we can see that the correct directories would be moved. One directory (./three) has no pdf, so it is skipped, and directory four contains a subdir where the pdf is located.
If this is useful to you, respond and I'll continue help, or it can be translated into another scripting language.
It is not my intention here to imply that my way is better, or that there is any fault in Opus, an awesome tool.