Created
August 22, 2016 11:28
-
-
Save gjergjsheldija/335bde5690c336d0a47be56f5f4687ad to your computer and use it in GitHub Desktop.
flatten directory structure and move files
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 | |
find */ -type f -exec bash -c 'file=${1#./};dir=${file%/*};echo mkdir "${dir/\//_}";echo mv "$file" "${file/\//_}"' _ '{}' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment