ERPNext frappe backup and restore in new site

Anjana Dhakal
1 min readJun 19, 2023

--

Original backup:

The only up-to-date backup in ERPnext is the sql file.The download can be done directly from the site or via the command line. However, if you need to back up a public and a private file, you should use a command line.

For backup with file:

:~/frappe-bench$ bench --site [sitename] backup --with-files

For backup all sites:

:~/frappe-bench$ && bench --verbose --site all backup

For backup database:

:~/frappe-bench$ bench --site {sitename} backup

Backup file save in route:sites/sitename/private/backup/[files]

Transfer file from server to local

We can transfer files with the help of command line tools as well as WINSCP application[https://winscp.net/eng/download.php].

To copy the file from server to local pc run cmd in local CLI or viceversa(run same cmd in server CLI to copy the file from local pc)

scp -P 22 [user]@server:/home/user/[path]/filename ~/localpath/filename

Restore the file:

Copy the file inside frappe-bench directory then run the following command

bench --site [sitename] --force restore [path sql database which file name] --with-private-files[filename] --with-public-files[filename]
bench migrate or bench --site [sitename] migrate

--

--