Created
February 21, 2019 16:13
-
-
Save proclaim/da0d52b479c82da0cecf434feca68f68 to your computer and use it in GitHub Desktop.
Pull Files Out From Subdirectories
This file contains hidden or 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
num=1 | |
find . -mindepth 2 -type f -print | while read x; do | |
y=$(basename "$x") | |
if [ -f "$y" ]; then | |
mv "$y" "$num"."$y" | |
num=$(( $num + 1 )) | |
fi | |
mv "$x" "$y" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment