From aff0bbda5e8ab8b3be2172d3dc62da2350e99eeb Mon Sep 17 00:00:00 2001 From: Tilman Date: Wed, 26 Oct 2011 09:10:47 +0200 Subject: [PATCH] Inital commit --- .classpath | 7 +++++++ .project | 18 ++++++++++++++++++ src/syncdates.groovy | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 src/syncdates.groovy diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..578e37e --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..652d906 --- /dev/null +++ b/.project @@ -0,0 +1,18 @@ + + + GroovyScripts + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.groovy.core.groovyNature + org.eclipse.jdt.core.javanature + + diff --git a/src/syncdates.groovy b/src/syncdates.groovy new file mode 100644 index 0000000..31575e1 --- /dev/null +++ b/src/syncdates.groovy @@ -0,0 +1,41 @@ +def srcDir = "/home/tilman/hidrive/users/tilman/Privat" +def srcDirLength = srcDir.size() +def destDir = "/media/Black/hidrive/users/tilman/Privat" + +def delClos + +def problemOutput = new File('differentSizes.txt') +problemOutput.append("Divergent sizes were detected for the following files:\n\n") +def problemCount = 0 + +def modifiedOutput = new File('changedDates.txt') +modifiedOutput.append("Changed dates for the following files:\n\n") +def modifiedCount = 0 + +delClos = { it.eachDir( delClos ); + it.eachFile { + def path = it.canonicalPath + def syncFile = new File(destDir + path[srcDirLength..path.size()-1]) + if (it.size() != syncFile.size()) { + problemOutput.append(syncFile.toString() + " (${it.size()}/${syncFile.size()})\n") + problemCount++ + //println "Filesize (${it.size()}/${syncFile.size()}): ${path}" + } + + //if ((syncFile.size() > 0) && (it.lastModified() != syncFile.lastModified())) {} // Ordner und nicht vorhandene Dateien überspringen? + + if ((it.size() == syncFile.size()) && (it.lastModified() != syncFile.lastModified())) { + //syncFile.setLastModified(it.lastModified()) + modifiedOutput.append(syncFile.toString() + " (${it.lastModified()}/${syncFile.lastModified()})\n") + modifiedCount++ + //println "Time (${it.lastModified()}/${syncFile.lastModified()}): ${path}" + } + } + } + +delClos( new File(srcDir) ) + +println "Detected divergent size for ${problemCount} files." +println "Modified dates for ${modifiedCount} files." + +return null \ No newline at end of file