Created
September 1, 2021 15:13
-
-
Save nishalkulkarni/782d5f32c81af844a3fbc0c9bf33fd99 to your computer and use it in GitHub Desktop.
This file contains 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
# chmod +x course_unzip.sh | |
# sudo cp course_unzip.sh /usr/bin/course_unzip | |
# course_unzip <<archive_name.zip>> <<extract_folder_name>> | |
mkdir -p $2 | |
unzip -qq $1 -d $2 | |
for entry in "$2"/* | |
do | |
newname="$(echo ${entry} |sed -e 's/.*Reference_Material_I*_//')" ; | |
month="$(echo ${newname} | grep -oP -- '-.*-2' | sed -e 's/-//; s/-2//')" ; | |
mkdir -p "$2/$month" | |
echo "$2/$month/$newname" | |
mv "$entry" "$2/$month/$newname" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment