Flatten a Directory Instantly in OS X Using Terminal Command

Sometimes we all get too weak creating folders within folders and you just have to iron it all down to one. OS X Daily offers a handy terminal command for this.

When you have directories inside other directories, you lose track of files pretty quickly. To put it all in one directory, a simple terminal command is enough. In this example, TargetDirectory is the subdirectory from which you want to move the content:

 find TargetDirectory / -mindepth 2 -type f -exec mv -i '{}' TargetDirectory / ';'

This will move all files located in the TargetDirectory to a higher directory. Visit OS X Daily for some more examples of how this works.

Flatten nested directory and file hierarchy from the OS X command line | OS X Daily

More…

Leave a Reply