Mac Extract Files From Multiple Folders

3 March 2013, 09:00


Ever wanted to get all the files out of a folder and its subfolders? For example, if iTunes manages your music collection you might want to make a copy of the music files contained in the various subfolders but without also copying the folder structure. I do this to when creating SD cards full of music to play on my car’s stereo.

How to Zip Files and Folders on Mac. To get started, open the “Finder” app, and locate the files or folders that you want to compress. If you’re selecting multiple files, hold the Command key while selecting the files. Once you’ve made the selection, right-click on it to view the context menu. Here, click the “Compress” option. In the toolbar, click iPack. To create tar file on Mac, click Add in the iPack window. Select the files or directories/folders you need to pack. Name your tar archive file and select a location to keep it. Click the Format dropdown list and choose the option Compress these files into a tar file. It’s generally good practice to avoid hard-coding file and folder paths in a script. Prompting the user to select files and folders makes for a more dynamic script that won’t break when paths change. Prompting for a File. Use the Standard Additions scripting addition’s choose file command to prompt the user to select a file. Open the folder using Finder, then type a single space into the search field at the top right. This will open the search options, which will default to “This Mac” (i.e. All files and folders on the computer). Click the name of the folder from which you want to extract files, which will be alongside.

Or perhaps somebody’s sent you a load of images in a series of subfolders and you want to extract them without any fuss.

The solution is simple.

1. Open the folder using Finder, then type a single space into the search field at the top right.
2. This will open the search options, which will default to “This Mac” (i.e. all files and folders on the computer). Click the name of the folder from which you want to extract files, which will be alongside.
3. Click the plus (+) button alongside the Save button at the top right of the window. This will add a new line of search conditions reading Kind: All. If you’re attempting to extract ALL files then leave this as it is. If you’re attempting to extract just music, for example, then change the Any dropdown to something appropriate.
4. Click the plus button at the right of this new line, which will add another search condition. Change the first dropdown on this to read Name. Leave the second dropdown as it is, but in the field alongside type two quotes (“”).
5. In the Finder window below you should see represented all the files in the folder, and any subfolders it contains. You can then click and drag these in the usual way to another folder to copy or move them.


Know better?

I must be doing something wrong, followed all instructions, and got the end result, but as a list, it will not let me select all, I cannot drag anything outside of the window it was sorted in. If I click the icon view button to get the exact same result as the screen dump on your page, it only gives me a blank page. Please help, I am so close yet so far from achieving what I need.
Many thanks

— John Rizk · Feb 5, 01:57 AM · #

Worked a treat thanks.

— Clive · Mar 1, 07:32 AM · #

John, I tried it again recently and it worked fine on El Capitan. Just try following the instructions again – maybe print them out?

— Keir · Mar 19, 02:39 AM · #

You are a legend Keir, thanks so much for your help, I gave it another shot and it WORKS Woot Woot!!!!!

— John · Apr 8, 06:42 PM · #

THANKYOU SO MUCH! I hung up with Apple Care earlier, and they told me I would have to extract each file MANUALLY (I HAVETHOUSANDS!!) I found this, and was able to put everything in 30 seconds! I actually called Apple back and had them do a screen share with me, so I could teach THEM how to do it – so they can pass on more helpful info to their customers! Without you, I would have spent ANOTHER 24 hours working on this project! THANKYOUTHANKYOUTHANKYOU SO MUCH!

— Kate · Apr 22, 01:08 PM · #

Cheers works very good

— ranger · Feb 18, 07:46 AM · #

Thank you so much, I needed to find repeated files in a bunch of folders, you have saved me. Have an awesome day!

— Elin Gómez Ronzón · Mar 9, 05:49 PM · #

THANKYOU SO MUCH!!! This just saved me endless hours of needless work!

— Megan · Aug 25, 03:44 PM · #

Very nice!

If anyone here work with Adobe Bridge you can go to the folder that contains subfolders click in Show > Show subfolder items. Then you select all files click in the right button over and click in > Move. Choose the place you want to move.

Voilá!

— Rodrigo · Jun 5, 05:22 PM · #

Very helpful! Thanks a lot!

— Elle · Aug 8, 11:36 PM · #

you are amazing! thank you so much:)

— Theodore · Sep 26, 06:31 PM · #

Thanks! Extracted 23,295 images. Now to find the ones I want.

NF

— Norman Fellows · Jan 6, 02:32 AM · #

Amazing! This worked, thank you. You are a national treasure.

— Nathan · Jun 19, 05:26 AM · #

Very helpful, I wish I knew this long ago… Thanks a bunch! Searching for any files on my Mac is real pleasure now.

— Angel Kukushev · Jul 1, 01:38 AM · #

Thank you from the bottom of my heart! This saved me a long slow descent into madness xx

— Megan · Oct 12, 07:02 PM · #

Thanks a ton! It worked like a charm.

— Prithvi · Dec 2, 09:07 AM · #

Hello, I am using Catalina 10.15.1 and am not able to get this search to show the music from the sub folders. I have settings of:
1. Opened Main Music Folder
2. created a space in the spotlight bar
3. Next to “This Mac” chose the folder
4. Selected + sign
5. added Kind -> Music -> All
6. Selected next + sign
7. added Name -> Contains -> “” in space

The folder sat all night saying loading but nothing has appeared from the search.

Thanks!

— Ranukic · Dec 5, 05:12 AM · #

Thankyouthankyou thankyo

— Ian Morrison · Jan 31, 06:58 AM · #

Extract Multiple Zip Folders

thank you!!!!!!! you really lightened my load

— sonidoselectronicos · Feb 25, 09:06 PM · #

◀︎ Competition time!
Right-click in Firefox ▶︎


Convenient though the Mac’s folder structure can be, there may be times when you’ve buried files within so many layers of folders that they’re no longer easy to find or deal with. For instance, you might have a decade’s worth of tax documents or a nest of old photos and notes. Although you could manually wade through those folders to bring your files to the surface, with an Automator application you can do it all with a simple drag and drop. Here’s how:

Set up your workflow

Mac extract files from multiple folders

Mac Extract Files From Multiple Folders Excel

Launch Automator (/Applications) and in the template chooser that appears, select Application. Add these actions to your workflow in order: Set Value of Variable (found under the Utilities heading), Get Folder Contents (under Files & Folders heading), Filter Finder Items (Files & Folders), Move Finder Items (Files & Folders), Get Value of Variable (Utilities), Get Folder Contents (Files & Folders), Filter Finder Items (Files & Folders), and Move Finder Items to Trash (Files & Folders).

How To Extract Files From Multiple Folders At Once Mac

Select the first action—Set Value of Variable—and choose New Variable from the Variable pop-up menu. In the resulting Variable Options window enter an intuitive name such as hostFolder and click Done. Within Automator choose View -> Variables. Your hostFolder variable should appear in the list of variables at the bottom of the workflow.

Mac Extract Files From Multiple Folders Without

In the second action—Get Folder Contents—enable the Repeat For Each Subfolder Found option. Configure the following Filter Finder Items action to read Kind Is Not Folder. In the next action—Move Finder Items—drag the hostFolder variable from the variables list at bottom of the workflow to the To pop-up menu so that its name appears in the pop-up menu. Enable the Replacing Existing Files option in this action. Leave the next Get Folder Contents action as it is—without the Repeat for Each Subfolder Found option checked. Configure the next Filter Finder Items action to read Kind is Folder. And finally, leave the Move Finder Items to Trash action alone. Name your workflow something like “Subfolder Zapper” and save it to the Desktop.

Put it to work

Extract Folder Files

When you drag a folder on to this workflow applet, all items buried in folders within that folder will be placed at the root level of the folder you dragged. So, for example, if you drag Folder A—which contains Folders B, C, and D—to the workflow, the files within those folders (and the contents of the folders within these folders) will move to Folder A. The workflow then goes on to delete the empty Folders B, C, and D.

How Do I Extract Files From Multiple Folders On A Mac

Note that the workflow functions properly only if you drag one folder to the applet at a time. Additionally, be warned that if you have files with duplicate names, the duplicate files will be deleted.