There's what you need to have:
- an item with certain quantity that's greater than one. Let's call this item "Foo" and it's quantity "X".
- another item with quantity different from "X", it can be an item that normally can't have quantity i.e. armor. Let's call this item "Bar".
- a container.
Now, the algorithm:
- place Bar right behind Foo in your inventory
- open the container
- alt+shift+click on item Foo, splitting window will appear
- confirm splitting
Foo will be transfered to container with quantity of X. You will also have two stacks of Bar with quantity of X/2.
There's one more thing: item that gets duplicated is not always right behind Foo. The more accurate description would be "item that moves to position of Foo, after Foo is transfered". So if in your inventory there is only one item in last row of items, you scroll inventory to the very bottom and transfer Foo (last row of items should disappear), item that was on top of Foo will be duplicated.
That's how Diablo should have done it's item duplication! Fast an reliable.