Created
December 11, 2019 14:42
-
-
Save sjvrijn/638926b5e0812e72146f8adb152e5fef to your computer and use it in GitHub Desktop.
invert directory hierarchy: A/B/* -> B/A/*
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
#!/bin/bash | |
for a in */; do | |
for b in $a/*/; do | |
dir=${b##*//} | |
mkdir -p $dir$a | |
mv $a$dir* $dir$a | |
done | |
rm -rf $a | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment