Well, it's easy to recover files deleted by Command Z. Command Z is to undo actions on Mac/MacBook. As you say, your folder has been deleted permanently. So the only way to get back your files is to use professional data recovery software. I recommend iBoysoft Data Recovery for Mac to you.
iBoysoft Data Recovery for Mac is reliable data recovery software that can help you to retrieve all kinds of files such as photos, videos, documents, etc. from SD cards, SSDs, HDDs, and USB flash drives easily and securely on macOS and MacOS X. And it also compatible with T2 chip, M2, M1, M1 Pro/Max.
Here's how to recover data deleted by Command Z with iBoysoft Data Recovery for Mac:
Step 1: Free download and launch iBoysoft Data Recovery for Mac.
Step 2: Choose the SD card.
Step 3: Click Search for Lost Data.
Step 4: Find and preview the files you want to recover.
Step 5: Click Recover and choose a location to store.
Step 6: Check if you get the files you want.