-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·37 lines (29 loc) · 1004 Bytes
/
setup.sh
File metadata and controls
executable file
·37 lines (29 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Source folder (where the original folders exist)
source_folder="${PWD}/.config"
# Destination folder (where symlinks will be created)
destination_folder="${HOME}/.config"
# Check if both folders exist
if [ ! -d "$source_folder" ]; then
echo "Source folder doesn't exist."
exit 1
fi
if [ ! -d "$destination_folder" ]; then
echo "Destination folder doesn't exist."
exit 1
fi
# Loop through each folder in the source folder
for folder in "$source_folder"/*; do
if [ -d "$folder" ]; then
# Get the folder name
folder_name=$(basename "$folder")
# Check if the symlink already exists in the destination folder
if [ -e "$destination_folder/$folder_name" ]; then
echo "Symlink for '$folder_name' already exists in destination folder."
else
# Create symlink
ln -s "$folder" "$destination_folder/$folder_name"
echo "Symlink created for '$folder_name'."
fi
fi
done