Created
January 28, 2014 16:07
-
-
Save mfurlend/8670573 to your computer and use it in GitHub Desktop.
recursive move all files in child folders to parent folder and delete child folder
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
#!/bin/bash | |
for dir in *; do | |
if test -d "$dir"; then | |
( | |
cd "$dir"; | |
find . -maxdepth 1 -type f -print0 | xargs -0 -I {} mv {} ../{} | |
); | |
rmdir "$dir"; | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment