-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup_dotfiles.sh
executable file
·44 lines (37 loc) · 1.02 KB
/
backup_dotfiles.sh
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
38
39
40
41
42
43
#!/bin/zsh
# Define the dotfiles directory
DOTFILES_DIR="$HOME/Documents/dotfiles/"
# Create the dotfiles directory if it doesn't exist
mkdir -p "$DOTFILES_DIR"
# List of files/folders to copy
declare -a files_to_copy=(
"$HOME/.zshrc"
"$HOME/.config/alacritty/alacritty.yml"
"$HOME/.config/i3/"
"$HOME/.config/mpd/"
"$HOME/.config/ncmpcpp/"
"$HOME/.config/nvim/"
"$HOME/.config/picom/"
"$HOME/.config/polybar/"
"$HOME/.config/wal/"
"$HOME/.config/dunst/"
"$HOME/.config/ncmpcpp/"
"$HOME/.config/qtile/"
"$HOME/.config/zathura/"
)
# Function to copy files and folders
copy_files() {
for item in "${files_to_copy[@]}"; do
if [ -e "$item" ]; then
# Copy files and folders preserving the directory structure
cp -r --parents "$item" "$DOTFILES_DIR"
echo "Copied $item to $DOTFILES_DIR"
else
echo "Warning: $item does not exist!"
fi
done
}
# Run the copy function
copy_files
# Confirm completion
echo "Dotfiles backup completed!"