Disorganizing files with Hazel?

Does anyone know of a way to reverse the organization imposed on a Hazel organize rule on a folder? I would like to pull a bunch of files out of nested folder into a flat file structure. It is tedious having to drill through layers of folders…

Begin at the top and search for the files - something like PDF, then select them all and drag to another folder.


Yes, you can put a bunch of files from a nested folder labyrinth into a flat folder structure.

“Run rules on folder contents” is the solution. Noodlesoft has an article at

Unfortunately, I am not able to test it right now, but it sounds doable. :slight_smile:

1 Like

That is also a very good idea! :slight_smile: And if you are not sure if all contents are PDFs, a search term “NOT kind:folder” should do the trick.

More on search:


You could do this in Terminal.app:

(Note: I am going to assume that your “Scansnap" folder is in your home directory. If it is somewhere else, such as ~/Documents/Scansnap/ then we’d need to adjust the command below.)

Here’s the command in Terminal:

find ~/Scansnap -mindepth 2 -type f -exec mv -vn {} ~/Scansnap \;

Here’s what that all means:

find ~/Scansnap = look in the folder ~/ScanSnap/ (change this as needed. Note that ‘~’ refers to your home directory)

-mindepth 2 = ignore any files which are already in the top-level of the ~/Scansnap folder, so this tells find to look at least 2 levels deep.

-type f = only look for files (not folders)

-exec mv -vn {} ~/Scansnap = run the command mv -vn on any file which matches {} and move it to the ~/Scansnap/ folder. Note that the -v flag to mv means show me the files as you move them and -n means “ do not overwrite existing files” (so if there are two files in the ~/Scansnap/ folder with the same name, it will not overwrite them).

\; = this is the end of the find command

Note after you run the command, you should still look for any files which might have been skipped because they had the same name, but it should get you most of the way there!


I have used this: https://www.publicspace.net/BigMeanFolderMachine/