diff --git a/1/euler001.bash b/e0001/euler0001.bash similarity index 100% rename from 1/euler001.bash rename to e0001/euler0001.bash diff --git a/1/euler001.jl b/e0001/euler0001.jl similarity index 100% rename from 1/euler001.jl rename to e0001/euler0001.jl diff --git a/1/euler001.js b/e0001/euler0001.js similarity index 100% rename from 1/euler001.js rename to e0001/euler0001.js diff --git a/1/euler1.py b/e0001/euler0001.py similarity index 100% rename from 1/euler1.py rename to e0001/euler0001.py diff --git a/1/euler1.rkt b/e0001/euler0001.rkt similarity index 100% rename from 1/euler1.rkt rename to e0001/euler0001.rkt diff --git a/2/euler002.jl b/e0002/euler0002.jl similarity index 100% rename from 2/euler002.jl rename to e0002/euler0002.jl diff --git a/2/euler2.rkt b/e0002/euler0002.rkt similarity index 100% rename from 2/euler2.rkt rename to e0002/euler0002.rkt diff --git a/3/euler003.jl b/e0003/euler0003.jl similarity index 100% rename from 3/euler003.jl rename to e0003/euler0003.jl diff --git a/3/euler3.rkt b/e0003/euler0003.rkt similarity index 100% rename from 3/euler3.rkt rename to e0003/euler0003.rkt diff --git a/4/euler4.rkt b/e0004/euler0004.rkt similarity index 100% rename from 4/euler4.rkt rename to e0004/euler0004.rkt diff --git a/5/euler005.jl b/e0005/euler0005.jl similarity index 100% rename from 5/euler005.jl rename to e0005/euler0005.jl diff --git a/5/euler5.rkt b/e0005/euler0005.rkt similarity index 100% rename from 5/euler5.rkt rename to e0005/euler0005.rkt diff --git a/6/euler6.rkt b/e0006/euler0006.rkt similarity index 100% rename from 6/euler6.rkt rename to e0006/euler0006.rkt diff --git a/7/euler7.rkt b/e0007/euler0007.rkt similarity index 100% rename from 7/euler7.rkt rename to e0007/euler0007.rkt diff --git a/8/euler8.rkt b/e0008/euler0008.rkt similarity index 100% rename from 8/euler8.rkt rename to e0008/euler0008.rkt diff --git a/9/euler9.rkt b/e0009/euler0009.rkt similarity index 100% rename from 9/euler9.rkt rename to e0009/euler0009.rkt diff --git a/10/euler10.R b/e0010/euler0010.R similarity index 100% rename from 10/euler10.R rename to e0010/euler0010.R diff --git a/10/euler10.bash b/e0010/euler0010.bash similarity index 100% rename from 10/euler10.bash rename to e0010/euler0010.bash diff --git a/10/euler10.cpp b/e0010/euler0010.cpp similarity index 100% rename from 10/euler10.cpp rename to e0010/euler0010.cpp diff --git a/10/euler010.js b/e0010/euler0010.js similarity index 100% rename from 10/euler010.js rename to e0010/euler0010.js diff --git a/10/euler10.rkt b/e0010/euler0010.rkt similarity index 100% rename from 10/euler10.rkt rename to e0010/euler0010.rkt diff --git a/14/euler14.rkt b/e0014/euler0014.rkt similarity index 100% rename from 14/euler14.rkt rename to e0014/euler0014.rkt diff --git a/16/euler16.cpp b/e0016/euler0016.cpp similarity index 100% rename from 16/euler16.cpp rename to e0016/euler0016.cpp diff --git a/16/euler16.py b/e0016/euler0016.py similarity index 100% rename from 16/euler16.py rename to e0016/euler0016.py diff --git a/16/euler16.rkt b/e0016/euler0016.rkt similarity index 100% rename from 16/euler16.rkt rename to e0016/euler0016.rkt diff --git a/20/euler20.py b/e0020/euler0020.py similarity index 100% rename from 20/euler20.py rename to e0020/euler0020.py diff --git a/25/euler25.rkt b/e0025/euler0025.rkt similarity index 100% rename from 25/euler25.rkt rename to e0025/euler0025.rkt diff --git a/30/euler30.rkt b/e0030/euler0030.rkt similarity index 100% rename from 30/euler30.rkt rename to e0030/euler0030.rkt diff --git a/35/euler35.cpp b/e0035/euler0035.cpp similarity index 100% rename from 35/euler35.cpp rename to e0035/euler0035.cpp diff --git a/47/euler47.rkt b/e0047/euler0047.rkt similarity index 100% rename from 47/euler47.rkt rename to e0047/euler0047.rkt diff --git a/48/euler48.py b/e0048/euler0048.py similarity index 100% rename from 48/euler48.py rename to e0048/euler0048.py diff --git a/87/euler87.R b/e0087/euler0087.R similarity index 100% rename from 87/euler87.R rename to e0087/euler0087.R diff --git a/87/euler87.cpp b/e0087/euler0087.cpp similarity index 100% rename from 87/euler87.cpp rename to e0087/euler0087.cpp diff --git a/rename-files.zsh b/rename-files.zsh new file mode 100755 index 0000000..610e8bb --- /dev/null +++ b/rename-files.zsh @@ -0,0 +1,44 @@ +#!/usr/bin/zsh + +foreach folder in $(find "$PWD" -maxdepth 1 -mindepth 1 -name ".*" -prune -o -type d -exec basename {} \;) + echo "moving folder $folder:" + number="$(( ${folder##e} ))" + if [[ $number -lt 10 ]]; then + newfolder="000$number" + elif [[ $number -lt 100 ]]; then + newfolder="00$number" + elif [[ $number -lt 1000 ]]; then + newfolder="0$number" + else + newfolder="$number" + fi + + if [[ "$folder" != "e$newfolder" ]]; then + git mv -v "$folder" "e$newfolder" + fi +end + +foreach folder in e* + cd "$folder" + + foreach file in * + echo "moving file $file:" + ending="${file##*.}" + number="$(( ${${file##euler}%%.*} ))" + if [[ $number -lt 10 ]]; then + newfile="000$number" + elif [[ $number -lt 100 ]]; then + newfile="00$number" + elif [[ $number -lt 1000 ]]; then + newfile="0$number" + else + newfile="$number" + fi + + if [[ "$file" != "euler${newfile}.${ending}" ]]; then + git mv -v "$file" "euler${newfile}.${ending}" + fi + end + + cd .. +end