-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincrementalBackupUNIXFiles
More file actions
executable file
·71 lines (66 loc) · 1.54 KB
/
incrementalBackupUNIXFiles
File metadata and controls
executable file
·71 lines (66 loc) · 1.54 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/bash -
#IncrementalBackupUNIXFiles 增量备份UNIX格式的文件。 -q quiet; -f = [listFileName]; -t = [destFolderName]
#命令效果同 rsync --files-from="YDZQModifyFileList2013-2-1UNIX" ./ "update/"
IFS="
"
#startRegion Option
while getopts ":qf:t:" optname
do
case "$optname" in
"q")
quiet=1
;;
"f")
listFileName=$OPTARG
;;
"t")
destFolderName=$OPTARG
;;
"?")
echo "unknown option $OPTARG"
;;
":")
echo "No argument value for option $OPTARG"
;;
*)
#should not occur
echo "unknown error while processing options"
;;
esac
done
echo $quiet
#endRegion Option
#listFileName=$OPTIND
echo $listFileName
#destFolderName=$OPTIND
echo $destFolderName
declare -a fileList
#echo ${fileList[@]}
#echo ${#fileList[@]}
#echo ${#fileList}
#echo ${fileList[2]}
#while read -r line
#do
# #echo $line
# fileList[${#fileList[@]}]="$line"
# #echo ${fileList[*]}
#done < $listFileName
#
#for f in ${fileList[*]}
#do
#grep "^CODE/" $listFileName | while read f ; do
LC_ALL=C sed 's/[^\x20-\x7f]//g' $listFileName | while read f ; do
if [ -z "$quiet" ] #if length of $quiet is 0
then
echo cp -rfi --parents "${f}" "${destFolderName}"
fi
if [ ! -d ${destFolderName} ]
then
if [ -z "$quiet" ]
then
echo mkdir ${destFolderName}
fi
mkdir ${destFolderName}
fi
cp -rfi --parents "${f}" "${destFolderName}"
done