Skip to content

Instantly share code, notes, and snippets.

@cab404
Created July 1, 2016 06:38
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 cab404/6f6565e3774a7df5fb9ee037633e05db to your computer and use it in GitHub Desktop.
Save cab404/6f6565e3774a7df5fb9ee037633e05db to your computer and use it in GitHub Desktop.
#!/bin/bash
IFS=$'\n';
echo "Moving tree to temporary folder"
for A in $(find -type f); do
mkdir -p .resort/$(dirname $A);
mv "$A" ".resort/$A";
done
echo "Restoring tree structure, applying sorting"
cd .resort;
for A in $(find -type f | sort); do
mv "$A" "../$A";
done
rm -rf .resort;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment