-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdirectoryCopyRecursive.sh
More file actions
37 lines (30 loc) · 1.15 KB
/
directoryCopyRecursive.sh
File metadata and controls
37 lines (30 loc) · 1.15 KB
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 @includes.sh
echo '###################################################'
echo '# Description: Copy a directory recursively & safely'
echo '# Usage: $ ./directoryCopyRecursive.sh /path/to/copy/from /path/to/copy/to'
echo '# Param 1: Copy path [from]'
echo '# Param 2: Copy path [to]'
echo '# Requires: rsync'
echo '###################################################'
echoNewline
################################################################################
################################################################################
# check parameters
if [[ $1 == "" ]] ; then
echoError "1st arg must be a directory to copy from"
exit 1
fi
size=1
if [[ $2 == "" ]] ; then
echoError "2nd arg must be a directory to copy to"
exit 1
fi
################################################################################
################################################################################
# do copy
rsync -rltgoDv "$1" "$2"
################################################################################
################################################################################
# complete
echoSuccess "Files copied!"