forked from telerik/docs-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy_local.sh
34 lines (26 loc) · 853 Bytes
/
copy_local.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
#!/bin/bash
if [ -z "$1" ]
then
echo $1
echo "Missing destination folder path."
exit 1
fi
destination=$1
echo "Start copying to $1"
if [ -z "$2" ] || [ "$2" = "false" ]; then
files_to_exclude="`cat ./exclude_files.txt`"
dirs_to_exclude="`cat ./exclude_dirs.txt`"
robocopy . "$destination" //XD $dirs_to_exclude //XF $files_to_exclude //E
else
rsync -arv --exclude-from=./.exclude $(pwd)/ "$destination"
fi
#shopt -s extglob
#cp -rf $(ls !(.git|.vscode|_site|.asset-cache|.contentignore|.gitignore|docs-watcher/node_modules)) $destination
echo "Copying finished."
echo "Adding build related files to .gitignore..."
merged_file_name="./.merged_tmp"
dest_gitignore="$destination/.gitignore"
cat $dest_gitignore ./.contentignore > $merged_file_name
sort -u $merged_file_name > $dest_gitignore
rm $merged_file_name
echo "Finished."