How to store the document in private folder of my working site?

Hello,

Good Morning.

I want to store my documents into the private / public folder of my working-active site through code.

So can’t get the correct path to that location.

Can anyone suggest me that how to get the path of that location?

My code:

frappe-bench/sites/{0}/private/files/{1}'.format(my_site[1], labels[0][0])

In that,
my_site[1] :- my active site name
labels[0][0] :- my document name

So basically, it goes to private/files and creates one document with my document name.

But it gives me an error like:

IOError: [Errno 2] No such file or directory:

Thank You.

use,

frappe.get_site_path('private', 'files')

frappe.get_site_path('public', 'files')

Refer file_manger.py for more details

1 Like

Thank You. :handshake: