How to set a item not be draggd in?

I want to set a item not be dragged in.
how can I do this?

for example.

I have two items:A and B. A is a file,and B is a directory.
I want:A can be dragged into B,but B cannot be dragged into A.

How can I get this?

I have known how to do that. Thanks.