Super Moderator
Location: Mönchengladbach
Occupation: Brückenkranführer / Staplerfahrer
wcf.user.option.userOption53: Nein
Master
Location: Schwelm
Occupation: Immobilien-Verwalter / Serveradministrator
wcf.user.option.userOption53: Nein
Administrator
Location: Hagen
Occupation: Mechatroniker (didaktische Systeme)
wcf.user.option.userOption53: Nein
PHP Source code |
|
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
#!/bin/bash
mappool="/home/server/mappool"
mappool_web="/home/server/mappool_web"
game="css"
bz2_include_filetypes="bsp dx80 dx90 html jpg mdl mp3 nav phy sw tga vmt vtf vvd wav"
diff_old="${game}_current.txt"
diff_new="${game}_new.txt"
bz2include() {
if [ $# = 1 ]; then
grep ".$1$"
return
fi
output=".$1$"
shift
for type in $@; do
output="$output|.$type$"
shift
done
egrep "$output"
return
}
filelist() {
# $1=mappool
# $2=game
find $2/ -type f | while read file; do echo ""$file" `stat -c "%Z" "$file"`"; done
}
diff_files() {
# $1=mappool
# $2=diff_old
# $3=diff_new
cd $1
diff "$2" "$3" | grep '^> ' | awk -F '"' '{print $2}'
cd "$OLDPWD"
}
diff_deleted_files() {
# $1=mappool
# $2=diff_old
# $3=diff_new
cd $1
diff "$2" "$3" | grep '^< ' | awk -F '"' '{print $2}'
cd "$OLDPWD"
}
cp_files() {
# $1=mappool
# $2=mappool_web
while read file; do
[[ ! -d "`dirname "$2/$file"`" ]] && mkdir -p "`dirname "$2/$file"`"
cp "$1/$file" "$2/$file"
done
}
cp_all() {
# $1=mappool
# $2=mappool_web
# $3=game
mkdir -p "$2/$3"
cp -r "$1/$3" "$2/"
}
check_create_diff() {
# $1=mappool
# $2=mappool_web
# $3=game
# $4=diff_old
# $5=diff_new
cd $1
if [ ! -f "$4" ]; then
filelist "$1" "$3" > $4
cp_all "$1" "$2" "$3"
fi
filelist "$1" "$3" > $5
cd "$OLDPWD"
}
compress_files() {
# $1=mappool_web
# $2=game
# $3=filetypes
find $1/$2 | bz2include $3 | while read file; do
bzip2 -v "$file" 2>&1 | grep -v " already exists.$"
done
}
check_create_diff "$mappool" "$mappool_web" "$game" "$diff_old" "$diff_new"
diff_files "$mappool" "$diff_old" "$diff_new" | cp_files "$mappool" "$mappool_web"
compress_files "$mappool_web" "$game" "$bz2_include_filetypes"
cp $mappool/$diff_new $mappool/$diff_old
|
Administrator
Location: Hagen
Occupation: Mechatroniker (didaktische Systeme)
wcf.user.option.userOption53: Nein
Quoted
Wie bei Linux find Ordner -exec bzip2 -9k '{}' \; bloß für Windows halt :D
Super Moderator
Location: Mönchengladbach
Occupation: Brückenkranführer / Staplerfahrer
wcf.user.option.userOption53: Nein
Administrator
Location: Hagen
Occupation: Mechatroniker (didaktische Systeme)
wcf.user.option.userOption53: Nein
Quoted from ""General_V""
Ich kann mich noch an ein Tool Erinnern, dort hat man einen bz2 Ordner und man musste alles in diesen Ordner packen was gepackt werden soll, das Programm hat dann alles was im bz2 Ordner war automatisch gepackt inkl. unterordner usw. das war was feines. Aber finde es nicht mehr und weiß den Namen nicht mehr
Administrator
Location: Hagen
Occupation: Mechatroniker (didaktische Systeme)
wcf.user.option.userOption53: Nein