If you find that you’ve accidentally nested files and folders too deeply within a directory, it’s easy to resolve by moving the impacted files via a single command.
First, let’s look at an example directory structure:
In this case, the contents of the top-level
/directory1 were mistakenly nested to deeply during a file migration.
To move its contents out to the top level, the following command would be used:
mv directory1/* .
However, you’ll need to reconcile the duplicate items or else the files in the top-level destination will be overwritten during the move. In this case, those duplicate files would be:
With those conflicts resolved and the
mv command issued, your resulting structure would look like this: