Skip to content

Instantly share code, notes, and snippets.

@blahah
Created April 13, 2017 14:32
Show Gist options
  • Save blahah/c2e29a5c3b805370c556237ab4b1da3b to your computer and use it in GitHub Desktop.
Save blahah/c2e29a5c3b805370c556237ab4b1da3b to your computer and use it in GitHub Desktop.
unnest nested dirs
for path in $(find ../articles_split/articles/ -type d -wholename '*\/*\/*\/*\/*' | grep '.\{36\}'); do
mergeddir=$(echo $path | sed 's/\([0-9]\)\/\([0-9]\)\/\([0-9]\)\/\([0-9]\)\/\([0-9]\)/\1\2\3\4\5/')
mkdir -p $mergeddir
cp -R $path/* $mergeddir/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment