Copying files from one installation to another

Hi,

I’m trying to move some information from one installation to another, without doing the whole backup-restore, to avoid bringing old issues to the new installation.

I am able to properly download-sanitize-upload the template with needed data, including some files’ paths.

I’ve copied the files to the same path on the new installation, but they are not loading, showing a Forbidden error.

I’ve checked for the file permissions to be correct, I have cleared the cache and the website cache, but files still don’t show up properly (images, attachments).

I’ve manually added a new file in the new installation, verified permissions and ownerships are the same between copied files and brand-new file, still I get the same issue.

Please help :pray:

1 Like

What type of deployment are you using?

A couple weeks back I followed these steps to migrate JUST the site. No apps etc.

Thank you for your reply.

I have erpnext v14 in cloud. I did another fresh installation on premise.

I’m moving information from the old cloud installation to the new on premise installation by exporting csv files with all the data, including images and attachments locations.

When I place the same images and same attachments from the old installation in the new installation, the files are not permitted to be accessed.

It seems that they are found, but not permitted to be shown (images a broken link, attachments as Not permitted error)

I am receiving these issues:

Traceback with variables (most recent call last):
File “apps/frappe/frappe/core/doctype/file/utils.py”, line 330, in attach_files_to_document
file.insert(ignore_permissions=True)
doc = <EmployeeMaster: CUE-10043>
event = ‘on_update’
attach_fields = [<DocField: 53b0e2acfe parent=Employee>, <DocField: Employee-col_contrato_laboral parent=Employee>, <DocField: Employee-recibo_eegsa parent=Employee>, <DocField: Employee-col_copia_dpi parent=Employee>, <DocField: Employee-col_carta_renuncia parent=Employee>]
df = <DocField: 53b0e2acfe parent=Employee>
value = ‘/files/Cindy Patricia Catalán García ERP29c432.jpg’
file = <File: unsaved>
File “apps/frappe/frappe/model/document.py”, line 251, in insert
self.run_method(“before_insert”)
self = <File: unsaved>
ignore_permissions = True
ignore_links = None
ignore_if_duplicate = False
ignore_mandatory = None
set_name = None
set_child_names = True
File “apps/frappe/frappe/model/document.py”, line 908, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
self = <File: unsaved>
args = ()
kwargs = {}
fn = <function Document.run_method..fn at 0x7f71f2796cb0>
method = ‘before_insert’
File “apps/frappe/frappe/model/document.py”, line 1260, in composer
return composed(self, method, args, **kwargs)
self = <File: unsaved>
args = ()
kwargs = {}
hooks = []
method = ‘before_insert’
doc_events = {'
': {‘after_insert’: [‘frappe.event_streaming.doctype.event_update_log.event_update_log.notify_consumers’], ‘on_update’: [‘frappe.desk.notifications.clear_doctype_notifications’, ‘frappe.core.doctype.activity_log.feed.update_feed’, ‘frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions’, ‘frappe.automation.doctype.assignment_rule.assignment_rule.apply’, ‘frappe.core.doctype.file.utils.attach_files_to_document’, ‘frappe.event_streaming.doctype.event_update_log.event_update_log.notify_consumers’, ‘frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date’, ‘frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type’], ‘after_rename’: [‘frappe.desk.notifications.clear_doctype_notifications’], ‘on_cancel’: [‘frappe.desk.notifications.clear_doctype_notifications’, ‘frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions’, 'frappe.event_streaming.doctype.event_update_log.event_update_log.notify_co…
composed = <function Document.hook..compose..runner at 0x7f71f2797be0>
compose = <function Document.hook..compose at 0x7f71f2796a70>
f = <function Document.run_method..fn at 0x7f71f2796cb0>
File “apps/frappe/frappe/model/document.py”, line 1242, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
self = <File: unsaved>
method = ‘before_insert’
args = ()
kwargs = {}
add_to_return_value = <function Document.hook..add_to_return_value at 0x7f71f2797400>
fn = <function Document.run_method..fn at 0x7f71f2796cb0>
hooks = ()
File “apps/frappe/frappe/model/document.py”, line 905, in fn
return method_object(*args, **kwargs)
self = <File: unsaved>
args = ()
kwargs = {}
method_object = <bound method File.before_insert of <File: unsaved>>
method = ‘before_insert’
File “apps/frappe/frappe/core/doctype/file/file.py”, line 69, in before_insert
self.save_file(content=self.get_content())
self = <File: unsaved>
File “apps/frappe/frappe/core/doctype/file/file.py”, line 458, in get_content
with open(file_path, mode=“rb”) as f:
self = <File: unsaved>
file_path = ‘./erp.lans.gt/public/files/Cindy Patricia Catalán García ERP29c432.jpg’
builtins.FileNotFoundError: [Errno 2] No such file or directory: ‘./erp.lans.gt/public/files/Cindy Patricia Catalán García ERP29c432.jpg’

Please help :pray:

Did you try with the method I linked to.