Skip to content

Instantly share code, notes, and snippets.

@mfurlend
Created January 28, 2014 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfurlend/8670573 to your computer and use it in GitHub Desktop.
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
#!/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