For anyone subscribed to this thead, there is another way of doing this, which doesn't require VBSCript, as explained in this thread:
[Help with copy command, distguish between file and directory)
See the second part of my reply. (The first part just explains the VBScript method from here.)