Can't export private keys

I am trying to backup my zcash wallet. I use Zcash Wallet UI 0.69. I wrote in zcash.conf exportdir=path/tomyfolder. I’ve tried from the UI wallet->backup and from the command line

zcash-cli backupwallet nameofbackup and I have the same error.
Please let me know what could I possibly do wrong. I’ve tried various of commands in the terminal and all the time the same
The error is:
An unexpected error occured while backing up wallet!
Error response from wallet: error code: -4
error message:
Cannot backup wallet until the -exportdir option has been set.

That syntax looks correct. Did you restart zcashd after adding this line to the config? Have you tried an absolute path to the export directory?

Also, this command backupwallet according to the docs “Safely copies wallet.dat to destination filename”. If you want the private keys consider using z_exportwallet so zcash-cli z_exportwallet nameofbackup as according to docs “Exports all wallet keys, for taddr and zaddr, in a human-readable format. Overwriting an existing file is not permitted.”

@garethtdavies thank you for your reply. After restart zcashd from the command line iexporting is working but I still can’t from the UI

You can export private keys individually with:

zcash-cli getaddressesbyaccount “”
zcash-cli dumpprivkey “t-addr”

Export Wallet: zcashd --exportdir=/home/noob/zcash/ and zcash-cli backupwallet backup

zcash-cli help or zcashd --help