'extract only the subfolder, not the whole folder

Is it possible to extract only a subfolder from an archive, rather than the whole folder?

I.E. : I have my .zip/.tar.gz file named my_archive, which has inside folder folder_1. folder_1 has inside subfolder_1, subfolder_2 and subfolder_3. I only want to directly extract subfolder_1 and subfolder_2. How do I do it?

It is ok if I copy folder_3 as well, the most important part is to go directly inside folder_1



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source