Created
March 26, 2016 06:46
-
-
Save gwparikh/7762fa9cf1f7860c6d28 to your computer and use it in GitHub Desktop.
Bash alias to flatten a directory (one level at a time, won't clobber files, gives a bit of help)
This file contains 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
alias flatten='if dlist=`ls -d */`; then for d in $dlist; do mv -n $d/* ./; done && rmdir $dlist || echo "Error removing directories. There are probably conflicting files." ; else echo "No directories to flatten"; fi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment