Skip to content

Instantly share code, notes, and snippets.

@serayuzgur
Last active May 22, 2020 12:51
Show Gist options
  • Save serayuzgur/28aa37ccbebe5385ffc50ed151778dfa to your computer and use it in GitHub Desktop.
Save serayuzgur/28aa37ccbebe5385ffc50ed151778dfa to your computer and use it in GitHub Desktop.
# copy this to .zshrc or similar place. usage 'flatten x' x is the directory to traverse and flatten
flatten() {
find $1 -mindepth 2 -type f -exec mv -f {} $1 ';'
find $1 -mindepth 1 -type d -exec rmdir {} ';'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment