Skip to content

Instantly share code, notes, and snippets.

@luvuong-le
Created July 4, 2020 07:38
Show Gist options
  • Save luvuong-le/71f431dbe59779919877764ea871d6c0 to your computer and use it in GitHub Desktop.
Save luvuong-le/71f431dbe59779919877764ea871d6c0 to your computer and use it in GitHub Desktop.
Copy a specific folder to specified location. Eg - Basic HTML,CSS,JS folder to generate fast
#!/bin/bash
# This could be a folder that has a basic HTML, CSS, JS setup
TEMPLATE_PATH="<path/to/templatefolder>"
function createTemplate() {
echo "Beginning Template Creation..."
# Navigate into the new directory
cd "${1}"
# Copy all files from template folder into the new folder
cp -r "${TEMPLATE_PATH}\." "${PWD}"
echo "Template Successfully Created."
}
# Create a new directory from the current directory into the new folder defined by user
if [ -d "${PWD}/$1" ]; then
echo "Folder Already Exists... Skipping"
else
echo "Creating Project Folder..."
mkdir "${PWD}/$1"
fi
# Create the directory
createTemplate "${PWD}/${1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment