1. First, create a Custom_field__c on your Custom_Object__c/standard object. Or you can choose an already existing field for the object.
  2. Search for the tab Excluded Object. 
  3. If unable to find then proceed to the next step otherwise skip to step number 5.
  4. Go to the Setup, search for "Tabs" in Quick Find. Click on "Tabs" and create a new "Tab" for the object Excluded Object (Namespace: DownloadFiles). Follow the steps to create a tab: https://help.salesforce.com/articleView?id=creating_custom_object_tabs.htm&type=5
  5. Go to the Excluded object, Create a ListView "All" and add Excluded Object Number, Object API Name, and Folder Name as the three fields in the list view as shown in the screenshot.
  6. Hit save. Look for your object for which you want to change the folder name. Edit that particular record's Folder Name with the newly created formula field (API Name) as shown in the screenshot. And hit save.
  7. Now go to the MFD tab/ lightning component and refresh it. You will now be able to download the files with the newly set folder name.