Bash Flatten Files in Nested Directories

How do you move all files from nested directories into one directory in Linux or bash?

find . -type f -exec mv -i '{}' . ';'

The above command will find all files in the current directory, and any other nested directories. Then it will run the mv command on all of the files listed. Which will effectively move all files into the current directory.

Leave a comment

Leave a Reply