Created
July 18, 2019 11:48
-
-
Save dittmaraz/fb4e0267d77a46ec0b08f0139c6de14a to your computer and use it in GitHub Desktop.
project sort bash script
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
for PRJDIR in $(ls -d */) # for each d in current dir | |
do | |
echo "Project Path: $PRJDIR" # print current dir to sort | |
options=("Move" "Delete" "Nothing") # Sort action array | |
echo | |
PS3="Select Action: " | |
select opt in "${options[@]}"; do # make menu from actions | |
echo | |
case $opt in | |
"Delete") # Delete | |
echo "Deleting $PRJDIR..." | |
rm -rf $PRJDIR # Remove directory | |
break | |
;; | |
"Move") # Move directory | |
PS3="Sort to where?" | |
select SORTDIRS in $(ls -d dz_*) # create menu of all sorting directories | |
do | |
echo | |
case $SORTDIRS in | |
"dz_personal") | |
echo "Moving $PRJDIR to ./dz_personal/" | |
mv $PRJDIR ./dz_personal/ | |
break | |
;; | |
"dz_testing") | |
echo "Moving $PRJDIR to ./dz_testing/" | |
mv $PRJDIR ./dz_testing/ | |
break | |
;; | |
"dz_tutorials") | |
echo "Moving $PRJDIR to ./dz_tutorials/" | |
mv $PRJDIR ./dz_tutorials/ | |
break | |
;; | |
esac | |
done | |
break | |
;; | |
"Nothing") | |
break | |
;; | |
esac | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment