File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Prompt for the name of the new folder
4+ echo " Please enter the name for the new folder:"
5+ read FOLDER_NAME
6+
7+ # Define the destination path
8+ DESTINATION_PATH=" ../../Projects/${FOLDER_NAME} "
9+
10+ # Create the new folder
11+ mkdir -p " $DESTINATION_PATH " & > /dev/null
12+ if [ $? -eq 0 ]; then
13+ echo " Directory created successfully."
14+ else
15+ echo " Failed to create directory."
16+ exit 1
17+ fi
18+
19+ # Copy all files and folders except the specified ones
20+ rsync -av --progress . " $DESTINATION_PATH " --exclude .git --exclude-from=.gitignore & > /dev/null
21+ if [ $? -eq 0 ]; then
22+ echo " All files copied successfully."
23+ else
24+ echo " Failed to copy files."
25+ exit 1
26+ fi
27+
28+ # Initialize a new git repository and make the first commit
29+ cd " $DESTINATION_PATH "
30+ git init & > /dev/null
31+ git add . & > /dev/null
32+ git commit -m " Initial commit" & > /dev/null
33+ if [ $? -eq 0 ]; then
34+ echo " Git repository initialized and first commit made."
35+ else
36+ echo " Failed to initialize git repository."
37+ exit 1
38+ fi
39+
40+ # Open the new folder in Visual Studio Code
41+ code .
42+ if [ $? -eq 0 ]; then
43+ echo " Visual Studio Code opened successfully."
44+ else
45+ echo " Failed to open Visual Studio Code."
46+ exit 1
47+ fi
48+
49+ echo " Process completed successfully."
You can’t perform that action at this time.
0 commit comments