Skip to content

Instantly share code, notes, and snippets.

@jonahbron
Created April 2, 2013 18:54
Show Gist options
  • Save jonahbron/5295089 to your computer and use it in GitHub Desktop.
Save jonahbron/5295089 to your computer and use it in GitHub Desktop.
A very small BASH script to "explode" a directory. That is, move it's contents to it's parent directory, and remove the old (now empty) directory. Very handy after unzipping archives, and things of that nature. Be sure to add it to your PATH for easy use.
#!/bin/bash
# Example usage
#
# $ explode dir/
find "$*" -maxdepth 1 -mindepth 1 -exec mv -f {} "$*/../" \;
rmdir "$*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment