Skip to content

Instantly share code, notes, and snippets.

@secobi
Created December 18, 2013 06:09
Show Gist options
  • Select an option

  • Save secobi/8017974 to your computer and use it in GitHub Desktop.

Select an option

Save secobi/8017974 to your computer and use it in GitHub Desktop.
recursively expanded directory tree view through bash
#!/bin/bash
#source http://stackoverflow.com/revisions/20620653/3
dir="/somedir/"
for i in "$dir"*; do
if [ -f "$i" ]; then
filename="${i%%.*}"
if [ ! -d "$filename" ]; then
mkdir "$filename"
fi
mv "$i" "$filename"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment