Password protecting folder or directory in java or python
If you mean folders on the file system then you could mimick this behavior by storing files in a password protected zip file. 
If you mean conceptual folders within your application then you are free to implement authentication any way you want. Normally this involves a user logging in to your application to gain access to the protected resources.
I am working on a project in which I need to implement a functionality wherein a folder or directory is protected using a password. As in, when someone tries to open that particular folder, a password prompt is presented to them. If correct password is entered, then folder access is granted or else not.
Is this possible using python or Java ? Is yes then how ? And if not then which language can be used ?
I tried searching a lot but nothing helpful came out of it.