Last active
July 12, 2016 14:29
-
-
Save kjlape/df72ff338c200de6dc40fed8ec918475 to your computer and use it in GitHub Desktop.
Useful directory merging commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # METHOD 1: | |
| # use this when there's a reasonable number of subdirectories | |
| mv dir1/* dir2/* dir3/* ... DESTINATION | |
| # Then if there are conflicts... | |
| cp -Rn dir2/* DESTINATION | |
| cp -Rn dir3/* DESTINATION | |
| #METHOD 2: | |
| # use this when there are too many subdirectories for mv to handle as args at once | |
| for dir in ./*; do mv "$dir" DESTINATION; done | |
| # --remove-source-files is technically optional, and could slow down the process; omit if disk space is not a constraint | |
| for dir in ./*; do rsync -avhP --remove-source-files "$dir" DESTINATION; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment