Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Rr697

macrumors member
Original poster
May 11, 2019
56
9
I have an external drive with A LOT of files in a lot of folders….. What is the fastest or correct way to remove all the individual folders from the external drive? Btw it’s 50TB of data so it’s too hard to go through and drag the files. Any advice? Does MacOS have this capability or does anyone know at any third party programs?

Running latest version of MacOS Monterey.

External HDD is HFS+ not APFS if anyone cares :)
 
Last edited:

wilberforce

macrumors 68030
Aug 15, 2020
2,932
3,211
SF Bay Area
Here is one way:

Open Finder
Select your external drive
Click Search
Type kind:NOT folder
Select all (Cmd A)
(You may need to then unselect some hidden files)
Copy and Paste (or Move) to a temp folder

I suggest you try it out on a small subset first!

Also see this:


Hope this helps
 
Last edited:

HDFan

Contributor
Jun 30, 2007
7,302
3,349
What is the fastest or correct way to remove all the individual folders from the external drive?

You want to move all of the files into just one folder?

If so are you sure that all of the files have unique names - there aren't any files with the same name?
 

hobowankenobi

macrumors 68020
Aug 27, 2015
2,130
936
on the land line mr. smith.
Even if it is only 50GB of files....that is an awful lot of files to wade through. While some folks like a flat filing system, finding anything requires knowing what to look for (vs. where to look), and likely very good file naming convention, or something else like good tagging.

I would not consolidate everything for the sake of fewer folders, without reviewing stuff first, and updating tagging, names, or other means of sorting info. Folders might be the least bad way. :)
 

MacGizmo

macrumors 68040
Apr 27, 2003
3,217
2,516
Arizona
Even if it is only 50GB of files....that is an awful lot of files to wade through...
I was thinking more along the line of having thousands upon thousands of files in a single folder is going to be a sloooowwww process just opening the folder and scrolling down the folder list. Forget about viewing in icon or column mode... that'll probably choke the Finder.
 

Boyd01

Moderator
Staff member
Feb 21, 2012
7,954
4,894
New Jersey Pine Barrens
having thousands upon thousands of files in a single folder is going to be a sloooowwww process just opening the folder and scrolling down the folder list.

You may not be giving the Finder enough credit. I am developing a mapping/gps web app and have a local copy on my Mac. Maps in this format consist of individual 256x256-pixel image tiles in nested folders, there are around 40 million of these in thousands of nested folders on my Mac (about 1tb total on an external SSD).

Just looked in one of these folders that contains about 4000 subfolders that each around 3000 png files inside. Slight delay of a few seconds opening these, but it certainly doesn't "choke". A folder with 3000 images opens very quickly in icon view actually and generates previews almost as fast as I can scroll.

Now, I do agree that it wouldn't be a good idea to have thousands of files in a single folder for most "normal" uses, however the technical limitations might not be as bad as you imagine.
 
  • Like
Reactions: orbital~debris

Christian Schumacher

macrumors member
Oct 3, 2015
59
25
I use Adobe Bridge for that. "Show itens from subfolders" with the "light table" workspace, along with several sorting options, allows one to have an overall glimpse without moving anything from its original place.
 
  • Like
Reactions: orbital~debris

Tagbert

macrumors 603
Jun 22, 2011
6,264
7,287
Seattle
I have an external drive with A LOT of files in a lot of folders….. What is the fastest or correct way to remove all the individual folders from the external drive? Btw it’s 50TB of data so it’s too hard to go through and drag the files. Any advice? Does MacOS have this capability or does anyone know at any third party programs?

Running latest version of MacOS Monterey.

External HDD is HFS+ not APFS if anyone cares :)
It might help us to advise you if you explain more about what you want to do?

  1. Delete all the folders (and their files)?
  2. Move all of the files into one folder?
  3. Something else?
Also explaining why might suggest a different option.
 
  • Like
Reactions: orbital~debris

zqbobs

macrumors member
Mar 10, 2009
61
16
I use Adobe Bridge for that. "Show itens from subfolders" with the "light table" workspace, along with several sorting options, allows one to have an overall glimpse without moving anything from its original place.
Prompted me to update my Adobe Bridge version, and yes, that kind of view is very useful. An alternative, non-Adobe, app is Graphic Converter, which has much the same capability.
 
  • Like
Reactions: orbital~debris

Rr697

macrumors member
Original poster
May 11, 2019
56
9
Here is one way:

Open Finder
Select your external drive
Click Search
Type kind:NOT folder
Select all (Cmd A)
(You may need to then unselect some hidden files)
Copy and Paste (or Move) to a temp folder

I suggest you try it out on a small subset first!

Also see this:


Hope this helps
The method you explained did not work for me I could not put "not" for the kind.
You want to move all of the files into just one folder?

If so are you sure that all of the files have unique names - there aren't any files with the same name?
Yes I want to move all the files in my 50TB Drive all under one single folder with no sub folders.
A "contrary" question:

Don't the folders (as they exist now) serve to organize the [many] files into useful segments?
Folders (themselves) do not take up disk space.
They're merely organizational tools...
The folders are from 12 different 8TB external hard drives many of which are duplicates and backups etc. I want to start over from scratch with folder naming and organizing.
I didn't think they could make a single 50TB external drive. Are you sure you don't mean 50 GB?

Also, I would be very careful about how many files you put in a single folder.
I have a 144TB DAS device. Its called the OWC Thunder Bay 8. 50TB is currently used of the 72TB (Due to Mirrored RAID)
Even if it is only 50GB of files....that is an awful lot of files to wade through. While some folks like a flat filing system, finding anything requires knowing what to look for (vs. where to look), and likely very good file naming convention, or something else like good tagging.

I would not consolidate everything for the sake of fewer folders, without reviewing stuff first, and updating tagging, names, or other means of sorting info. Folders might be the least bad way. :)
I have about 100,000 files on the drive which makes up 49.5TB. I have spent 2 months devising new organization and naming conventions that I think i will be really happy with but i cant start the project until i can get rid of all the folders.
I was thinking more along the line of having thousands upon thousands of files in a single folder is going to be a sloooowwww process just opening the folder and scrolling down the folder list. Forget about viewing in icon or column mode... that'll probably choke the Finder.
It should only be all in 1 folder for the initial setup as soon as I get rid of all the folders I will have about 100,000 files all folderless....It sounds like heaven, I know. Then i can organize all the files into the folder system I need.
You may not be giving the Finder enough credit. I am developing a mapping/gps web app and have a local copy on my Mac. Maps in this format consist of individual 256x256-pixel image tiles in nested folders, there are around 40 million of these in thousands of nested folders on my Mac (about 1tb total on an external SSD).

Just looked in one of these folders that contains about 4000 subfolders that each around 3000 png files inside. Slight delay of a few seconds opening these, but it certainly doesn't "choke". A folder with 3000 images opens very quickly in icon view actually and generates previews almost as fast as I can scroll.

Now, I do agree that it wouldn't be a good idea to have thousands of files in a single folder for most "normal" uses, however the technical limitations might not be as bad as you imagine.
Yea Im not worried It will only have 100,000 files in it for about 10 minutes before I start moving lots of files into lots of folders.... I would assume my biggest folder may have 2,000 images in it when everything is all said and done. Probably will end up around 1500 Folders with an elaborate tagging system to quickly sort through that 1500 folder space.
I use Adobe Bridge for that. "Show itens from subfolders" with the "light table" workspace, along with several sorting options, allows one to have an overall glimpse without moving anything from its original place.
I just downloaded this the other day and was starting to play around with it but Its not what I'm looking for for "This"
It might help us to advise you if you explain more about what you want to do?

  1. Delete all the folders (and their files)?
  2. Move all of the files into one folder?
  3. Something else?
Also explaining why might suggest a different option.
Gladly,
I want to move all 100,000 files currently in a couple hundred folders on my 50TB Drive/folder all out of the folders they are in so I can start over from scratch with proper naming conventions and tagging. I have dragged Twelve 8TB External drives all into this one huge RAID array and need to now organize it because as of right now its impossible to find anything.

OP put post up... then... disappeared...
I left for a wedding across the country. This question was burning at me before I left. ANow that I have returned, I have returned :)
Prompted me to update my Adobe Bridge version, and yes, that kind of view is very useful. An alternative, non-Adobe, app is Graphic Converter, which has much the same capability.

I guess they didn’t want an answer, after all.
BACK
 

Tagbert

macrumors 603
Jun 22, 2011
6,264
7,287
Seattle
depending on how you want to distinguish and organize the files, you might want to script moving them using the command line. For instance, if you wanted to move all of the png files that start with "abc" you would do a wildcard to select something like "abc*.png" recursively and then move those to some folder. Don't take what I wrote as correct, it was just an approximation. I don't use the command line a lot and would need to lookup the proper commands and query parameters.

The approach would probably depend on how you are segmenting those files.
 

Rr697

macrumors member
Original poster
May 11, 2019
56
9
I don't have any file names necessarily id like to organize like that I just want to strip the folder enclosures from the main folder/drive.
 

Boyd01

Moderator
Staff member
Feb 21, 2012
7,954
4,894
New Jersey Pine Barrens
depending on how you want to distinguish and organize the files, you might want to script moving them using the command line.
I did something like this a number of times recently. I was downloading USGS geodata in .zip files. There were many files in each zipped folder but I only wanted the .img files. So, I put them all in one directory, mass un-zipped them and used a shell command to extract the files I wanted to another folder. Quick and easy.

Just tried a little test that might be more like what you are doing. I made a folder named test with 4 sub-folders that each have a number of .JPG files inside.

Screen Shot 2022-09-07 at 6.33.34 PM.png


This is what it looks like in the terminal

Code:
% cd test
% ls images/*

images/folder1:
DSCN8027.JPG    DSCN8029.JPG    DSCN8031.JPG    DSCN8033.JPG
DSCN8028.JPG    DSCN8030.JPG    DSCN8032.JPG

images/folder2:
DSCN7836.JPG    DSCN7838.JPG    DSCN7840.JPG    DSCN7842.JPG
DSCN7837.JPG    DSCN7839.JPG    DSCN7841.JPG    DSCN7843.JPG

images/folder3:
DSCN7851.JPG    DSCN7853.JPG    DSCN7855.JPG    DSCN8025.JPG
DSCN7852.JPG    DSCN7854.JPG    DSCN8024.JPG    DSCN8026.JPG

images/folder4:
DSCN0438.JPG    DSCN0440.JPG    DSCN0442.JPG    DSCN0444.JPG
DSCN0439.JPG    DSCN0441.JPG    DSCN0443.JPG

Then I entered this command which moved all the enclosed images the destination folder.

Code:
% mv images/*/*.JPG destination

% ls destination
DSCN0438.JPG    DSCN0444.JPG    DSCN7841.JPG    DSCN7854.JPG    DSCN8028.JPG
DSCN0439.JPG    DSCN7836.JPG    DSCN7842.JPG    DSCN7855.JPG    DSCN8029.JPG
DSCN0440.JPG    DSCN7837.JPG    DSCN7843.JPG    DSCN8024.JPG    DSCN8030.JPG
DSCN0441.JPG    DSCN7838.JPG    DSCN7851.JPG    DSCN8025.JPG    DSCN8031.JPG
DSCN0442.JPG    DSCN7839.JPG    DSCN7852.JPG    DSCN8026.JPG    DSCN8032.JPG
DSCN0443.JPG    DSCN7840.JPG    DSCN7853.JPG    DSCN8027.JPG    DSCN8033.JPG

2.png


You would probably need something a bit more complicated that might require some experimentation. I would create a little "testing grounds" with samples of exactly what you are trying to move. And you certainly would want to have one or more good backups!
 

kschendel

macrumors 65816
Dec 9, 2014
1,310
591
In the terminal:

cd external-drive-mount-point
mkdir new-folder-name
find . -type f -exec mv '{}' new-folder-name \;

and now all your files should be in new-folder-name. The old folders will still be around, but should all be empty.

The external mount point name will probably be something like /System/Volumes/XXX where XXX is the name that the Finder shows as your external drive name. The terminal command "df" will show you all the mount-points in the final column.
 
  • Like
Reactions: Brian33 and Boyd01

Boyd01

Moderator
Staff member
Feb 21, 2012
7,954
4,894
New Jersey Pine Barrens
The external mount point name will probably be something like /System/Volumes/XXX where XXX is the name that the Finder shows as your external drive name.

There's a very easy way to do this (unless you're a purist, LOL). Just open a terminal window and type "cd " - that is the letters cd followed by a blank space. Now just drag the desired disk to the terminal window and drop it. That will auto-complete the command and put you in the root directory of the external drive when you press the carriage return key.

I do this a lot. When I want to change to a new directory, I just drag the folder to the terminal window. You can also drag files into terminal as an alternative to typing the full name.
 
  • Like
Reactions: hobowankenobi

Rr697

macrumors member
Original poster
May 11, 2019
56
9
In the terminal:

cd external-drive-mount-point
mkdir new-folder-name
find . -type f -exec mv '{}' new-folder-name \;

and now all your files should be in new-folder-name. The old folders will still be around, but should all be empty.

The external mount point name will probably be something like /System/Volumes/XXX where XXX is the name that the Finder shows as your external drive name. The terminal command "df" will show you all the mount-points in the final column.
So if I do this it will strip all the files from all the folders and I will be left with blank folders? Side question is there anyway to lock any folders from being affected with this method?
 

Tagbert

macrumors 603
Jun 22, 2011
6,264
7,287
Seattle
So if I do this it will strip all the files from all the folders and I will be left with blank folders? Side question is there anyway to lock any folders from being affected with this method?
You might setup a script using a list of folders that you want to operate this on. then use those folder names as a parameter for the 'find' command.
 

kschendel

macrumors 65816
Dec 9, 2014
1,310
591
So if I do this it will strip all the files from all the folders and I will be left with blank folders? Side question is there anyway to lock any folders from being affected with this method?

You can add to the find command:

find . \( -name 'folder1' -or -name 'folder2' -or ... -prune \) -or -type f -exec mv '{}' new-folder-name \;

If you want to see what you're finding first, replace -exec and everything after with -print.

"man find" in the terminal will print out a man page for find. It's a complex command that can be very flexible if you get it right.
 
  • Like
Reactions: Tagbert and Boyd01

kschendel

macrumors 65816
Dec 9, 2014
1,310
591
By the way, if you want to clean out empty folders after you move files, you can use find again:

find -d . -type d -print | xargs rmdir

The rmdir command won't delete directories (folders) with files inside, so you can just let it rip. The -d option tells find to operate from the bottom up, so if you have nested empty folders it will get them all.

The xargs thing collects a bunch of folder names and feeds them all to the rmdir command. You could use the -exec form but xargs is faster. Unfortunately you can't use xargs with the mv command because you need the move-to folder name at the end of the mv command and xargs doesn't know how to do that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.