This article is from the Problem Behaviors in Cats FAQ, posted to rec.pets.cats newsgroup. Maintained by Cindy Tittle Moore with numerous contributions by others.
Cats love closets, since they're dark hidey holes full of fun stuff. But you may not want your cat to swing on your good silk clothing or rearrange your shoes. Conversely, you might want your cat to be able to get into the closet and keep larger pets out.
If you have a swing-and-shut door, you might try a cat door to allow the cat access. A child-barrier that lets the cat jump over but not the dog is another possibility. Or a chain (like the chain some front doors have) might work.
A solution with closets that have double sliding doors is to drill a hole through the area of overlap, with the doors positioned closed or partially opened as you wish. Then you can use a nail or a peg in the hole to keep the doors in position.