I have a built in closet with sliding doors. When the doors are closed there is an overlap in the center of about 2 inches. I installed a push pin type lock in the center where the overlap occurs. The lock is screwed into the side edge of the door in front and a hole is drilled behind it. There is a metal sleeve that goes in the hole to finish off the appearance. When it is locked the pin in the lock goes into the hole behind it. I installed it at the bottom near the floor for esthetic purposes. I got it at the local big box home improvement store. I tried to find one like it online and was unsuccessful. I found others that mount differently and I don’t know if the pin would be long enough. You could also try the ratchet type locks that are used for glass display cases.
I will say it’s not the most secure thing in the world. It sends a message of “hey, stay out” but if they want in there is enough play in the doors for them to force them apart. A longer pin would prevent that on my door but I wasn’t able to find a lock with the same configuration I have and a longer pin. I had some PIA Italian guests who forced their way into that closet and put a big scratch along the bottom of the door.
I’d be happy to take a picture of my set up when my current guest checks out if you’re interested.