-
-
Save lukaselmer/4215465 to your computer and use it in GitHub Desktop.
Revisions
-
pencil revised this gist
Nov 8, 2012 . 1 changed file with 18 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,10 @@ #!/usr/bin/env ruby require 'fileutils' require 'optparse' SOURCEDIR='/Volumes/root/skripte' DESTDIR="/Users/#{ENV['USER']}/Dropbox/Documents/HSR/Semester5/skripte" Subject = Struct.new :source, :destination, :parameters SUBJECTS = [ @@ -24,6 +16,22 @@ Subject.new('Informatik/Fachbereich/Enterprise_Computing/EnCom/', 'EnCom') ] verbose = false OptionParser.new do |opts| opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v| verbose = v end end.parse! unless File.exists? SOURCEDIR puts "Source directory #{SOURCEDIR} does not exist!" exit 1 end unless File.exists? DESTDIR puts "Destination directory #{DESTDIR} does not exist!" exit 1 end FileUtils.chmod_R('u+w', DESTDIR) start = Time.now @@ -37,7 +45,7 @@ unless File.exists? destination Dir.mkdir destination end system("rsync --delete -a#{'v' if verbose} #{subject.parameters || ''} '#{SOURCEDIR}/#{subject.source}' '#{destination}'") end puts "Syncing finished. It took #{Time.now - start} seconds." -
pencil revised this gist
Nov 8, 2012 . 2 changed files with 43 additions and 74 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ #!/usr/bin/env ruby require 'fileutils' SOURCEDIR='/Volumes/root/skripte' DESTDIR="/Users/#{ENV['USER']}/Dropbox/Documents/HSR/Semester5/skripte" unless File.exists? SOURCEDIR puts "Source directory #{SOURCEDIR} does not exist!" exit 1 end unless File.exists? DESTDIR puts "Destination directory #{DESTDIR} does not exist!" exit 1 end Subject = Struct.new :source, :destination, :parameters SUBJECTS = [ Subject.new('Informatik/Fachbereich/Computernetze_1/CN1/', 'CN1', '--exclude *.pcap --exclude Videos'), Subject.new('Mathematik_Naturwissenschaften/Physik_1/Ph1Mech/', 'Ph1Mech'), Subject.new('Informatik/Fachbereich/Informations-_und_Codierungstheorie/ICTh/', 'ICTh', '--exclude Signal-Videos/*.exe'), Subject.new('Informatik/Fachbereich/Microsoft-Technologien/MsTe/', 'MsTe'), Subject.new('Informatik/Fachbereich/Betriebssysteme_1/Bsys1/', 'Bsys1'), Subject.new('Informatik/Fachbereich/Enterprise_Computing/EnCom/', 'EnCom') ] FileUtils.chmod_R('u+w', DESTDIR) start = Time.now puts "Syncing files with Dropbox (#{start.inspect})..." puts "Source: #{SOURCEDIR}/... // Destiniation: #{DESTDIR}/..." SUBJECTS.each do |subject| puts "> #{subject.destination}" destination = "#{DESTDIR}/#{subject.destination}" unless File.exists? destination Dir.mkdir destination end system("rsync --delete -av #{subject.parameters || ''} '#{SOURCEDIR}/#{subject.source}' '#{destination}'") end puts "Syncing finished. It took #{Time.now - start} seconds." This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,74 +0,0 @@ -
petermanser revised this gist
Sep 24, 2012 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,11 @@ SOURCEDIR="/Volumes" DESTDIR="/Users/peter/Dropbox/HSR" mounts=( "//[email protected]/skripte /Volumes/skripte" "//[email protected]/ebooks /Volumes/ebooks" ) sources=( "skripte/Mathematik_Naturwissenschaften/Physik_1/Ph1Mech/Nordborg/" "skripte/Mathematik_Naturwissenschaften/Physik_1/Ph1Mech/P1 Modulschlusspruefungen Aufg und Loes/" @@ -41,6 +46,15 @@ chmod -R u+w $DESTDIR || return 1 START=$(date +%s) echo "Mounting required shares..." for (( i = 0 ; i < ${#mounts[@]} ; i++ )); do mount=${mounts[$i]} echo " > $mount" mkdir -p `echo $mount | awk -F" " '{print $2}'` mount -t smbfs $mount done echo "Syncing files with Dropbox (`date "+%d.%m.%Y %H:%M:%S"`)..." echo "Source: $SOURCEDIR/... // Destiniation: $DESTDIR" -
petermanser revised this gist
Sep 24, 2012 . 1 changed file with 21 additions and 41 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,76 +3,56 @@ SOURCEDIR="/Volumes" DESTDIR="/Users/peter/Dropbox/HSR" sources=( "skripte/Mathematik_Naturwissenschaften/Physik_1/Ph1Mech/Nordborg/" "skripte/Mathematik_Naturwissenschaften/Physik_1/Ph1Mech/P1 Modulschlusspruefungen Aufg und Loes/" "skripte/Informatik/Fachbereich/Wirtschaftsinformatik_1/WI1/" "skripte/Informatik/Fachbereich/Microsoft-Technologien/MsTe/" "skripte/Informatik/Fachbereich/Betriebssysteme_1/Bsys1/" "skripte/Informatik/Fachbereich/Internettechnologien/IntTe/HS2012/" "skripte/Informatik/Fachbereich/Informations-_und_Codierungstheorie/ICTh" "skripte/Informatik/Fachbereich/Computernetze_1/CN1/" "ebooks/Informatik/" ) dests=( "skripte/Semester5/Ph1Mech" "skripte/Semester5/Ph1Mech/Pruefungen" "skripte/Semester5/WI1" "skripte/Semester5/MsTe" "skripte/Semester5/Bsys1" "skripte/Semester5/IntTe" "skripte/Semester5/ICTh" "skripte/Semester5/CN1" "ebooks" ) params=( "" "" "" "" "" "" "" "" "" ) chmod -R u+w $DESTDIR || return 1 START=$(date +%s) echo "Syncing files with Dropbox (`date "+%d.%m.%Y %H:%M:%S"`)..." echo "Source: $SOURCEDIR/... // Destiniation: $DESTDIR" for (( i = 0 ; i < ${#sources[@]} ; i++ )); do dest=${dests[$i]} echo " > $dest" if [ ! -d "$DESTDIR/$dest" ]; then mkdir "$DESTDIR/$dest" fi rsync -azr ${params[$i]} "$SOURCEDIR/${sources[$i]}" "$DESTDIR/$dest" done END=$(date +%s) -
petermanser revised this gist
Mar 6, 2012 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,10 @@ SOURCEDIR="/Volumes" DESTDIR="/Users/peter/Dropbox/HSR" mounts=( "//[email protected]/skripte /Volumes/skripte" "//[email protected]/ebooks /Volumes/ebooks" ) sources=( "skripte/Kommunikation_Wirtschaft_Recht/Business_und_Recht_2/ReVertr/Sandro Ruggli/" "skripte/Kommunikation_Wirtschaft_Recht/Business_und_Recht_2/ManagSim/" @@ -46,6 +50,17 @@ chmod -R u+w $DESTDIR || return 1 START=$(date +%s) echo "Mounting required shares..." for (( i = 0 ; i < ${#mounts[@]} ; i++ )); do mount=${mounts[$i]} echo " > $mount" mkdir -p `echo $mount | awk -F" " '{print $2}'` mount -t smbfs $mount done echo "Syncing files with Dropbox (`date "+%d.%m.%Y %H:%M:%S"`)..." echo "Source: $SOURCEDIR/... // Destiniation: $DESTDIR" -
petermanser revised this gist
Mar 6, 2012 . 1 changed file with 27 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,23 +4,40 @@ SOURCEDIR="/Volumes" DESTDIR="/Users/peter/Dropbox/HSR" sources=( "skripte/Kommunikation_Wirtschaft_Recht/Business_und_Recht_2/ReVertr/Sandro Ruggli/" "skripte/Kommunikation_Wirtschaft_Recht/Business_und_Recht_2/ManagSim/" "skripte/Kommunikation_Wirtschaft_Recht/Italienisch_1/Ital1/" "skripte/Mathematik_Naturwissenschaften/Mathematische_Grundlagen_der_Informatik_2/Math2I/FS12_Mueller/" "skripte/Informatik/Fachbereich/Datenbanksysteme_1/Dbs1/" "skripte/Informatik/Fachbereich/Datenbanksysteme_2/Dbs2/" "skripte/Informatik/Fachbereich/Software-Engineering_2/SE2/FS2012/" "skripte/Informatik/Fachbereich/Software-Engineering_2_-_Projekt/SE2P/FS2012/" # "skripte/Informatik/Fachbereich/Software-Engineering_2_-_Projekt/SE2P/Beispiele/" "skripte/Informatik/Fachbereich/User_Interfaces_2/UInt2/" "ebooks/Informatik/" ) dests=( "skripte/Semester4/ReVertr" "skripte/Semester4/ManagSim" "skripte/Semester4/Ital1" "skripte/Semester4/Math2I" "skripte/Semester4/Dbs1" "skripte/Semester4/Dbs2" "skripte/Semester4/SE2" "skripte/Semester4/SE2-Projekt" # "skripte/Semester4/SE2-Projekt/Beispiele" "skripte/Semester4/UInt2" "ebooks" ) params=( "" "" "" "" "" "" "" # "" "" "" ) @@ -45,4 +62,4 @@ done END=$(date +%s) DIFF=$(($END-$START)) echo "Syncing finished. It took $DIFF seconds." -
petermanser revised this gist
Mar 6, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ for (( i = 0 ; i < ${#sources[@]} ; i++ )); do mkdir "$DESTDIR/$dest" fi rsync -az ${params[$i]} "$SOURCEDIR/${sources[$i]}" "$DESTDIR/$dest" done END=$(date +%s) -
petermanser created this gist
Sep 6, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ #!/bin/sh SOURCEDIR="/Volumes" DESTDIR="/Users/peter/Dropbox/HSR" sources=( "skripte/Mathematik_Naturwissenschaften/Analysis_2_fuer_Informatiker/An2I/" "skripte/Informatik/Fachbereich/Programmieren_2_Programmierkonzepte/Prog2/" "skripte/Informatik/Fachbereich/Programmieren_3_C++/Prog3/" "pmanser/Documents/modules/Prog3/" "ebooks/Informatik/" ) dests=( "skripte/Semester2/An2I" "skripte/Semester2/Prog2" "skripte/Semester2/Prog3" "modules/Semester2/Prog3" "ebooks" ) params=( "" "" "--exclude='Admin'" "" "" ) chmod -R u+w $DESTDIR || return 1 START=$(date +%s) echo "Syncing files with Dropbox (`date "+%d.%m.%Y %H:%M:%S"`)..." echo "Source: $SOURCEDIR/... // Destiniation: $DESTDIR" for (( i = 0 ; i < ${#sources[@]} ; i++ )); do dest=${dests[$i]} echo " > $dest" if [ ! -d "$DESTDIR/$dest" ]; then mkdir "$DESTDIR/$dest" fi rsync -azr ${params[$i]} "$SOURCEDIR/${sources[$i]}" "$DESTDIR/$dest" done END=$(date +%s) DIFF=$(($END-$START)) echo "Syncing finished. It took $DIFF seconds."