diff --git a/.classpath b/.classpath
new file mode 100755
index 0000000..fe2d5f8
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..d2b0fa3
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..09dbac8
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/markdown.xml b/.idea/markdown.xml
new file mode 100644
index 0000000..1e34094
--- /dev/null
+++ b/.idea/markdown.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b5900ed
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..57cae7a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# treesize
+
+Rudimentäre Quick-and-dirty-Implementation des tree-Kommandos (Linux), einmal in Java und einmal in Scala
+
+* 16-Oct-2019 Erstellt und in svn-Repo hochgeladen
+* 02-Jun-2022 Mit git2svn in lokales git-Repo migriert und in selbstgehosteten Gitea-Server gepusht
+___
+RS 02-Jun-2022
\ No newline at end of file
diff --git a/src/dev/rsems/treesize/j/Test.java b/src/dev/rsems/treesize/j/Test.java
new file mode 100755
index 0000000..cfab0c4
--- /dev/null
+++ b/src/dev/rsems/treesize/j/Test.java
@@ -0,0 +1,87 @@
+package dev.rsems.treesize.j;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+public class Test {
+ //
+ private static String CORNER = "└── ";
+ private static String BLANK = " ";
+ private static String JUNCTION = "├── ";
+ private static String LINE = "│ ";
+
+ static void recurse(Directory d, int level) {
+ List subs = d.children;
+ for (int i = 0; i < subs.size(); i++) {
+ Directory child = subs.get(i);
+ Long ts = child.totalSize;
+ if (true) /* (ts >= 100000000L) */ {
+ StringBuilder sb = new StringBuilder(String.format("D %,16d ", ts));
+ String s = "";
+ Directory temp = child;
+ int loop = 0;
+ while (temp.parent != null) {
+ if (temp.parent.children.indexOf(temp) == temp.parent.children.size() - 1) {
+ if (loop == 0) {
+ s = CORNER + s;
+ } else {
+ s = BLANK + s;
+ }
+ } else if (loop == 0) {
+ s = JUNCTION + s;
+ } else {
+ s = LINE + s;
+ }
+ temp = temp.parent;
+ loop++;
+ }
+ sb.append(s).append(child.fsdir.getName());
+ System.out.println(sb.toString());
+ }
+
+ /* if (level <= 4) */
+
+ recurse(child, level + 1);
+
+ int j = 0;
+ for (File f : child.files) {
+ Long fs = f.length();
+ StringBuilder sb = new StringBuilder(String.format(" %,16d ", fs));
+ String s = "";
+ Directory temp = child;
+ int loop = 0;
+ while (temp.parent != null) {
+ if (temp.parent.children.indexOf(temp) == temp.parent.children.size() - 1) {
+ s = BLANK + s;
+ } else if (loop == 0) {
+ s = JUNCTION + s;
+ } else {
+ s = LINE + s;
+ }
+ temp = temp.parent;
+ loop++;
+ }
+ if (j == child.files.length - 1) {
+ s = s + CORNER;
+ } else {
+ s = s + JUNCTION;
+ }
+ sb.append(s).append(f.getName());
+ System.out.println(sb.toString());
+ j++;
+ }
+ }
+ }
+
+ public static void main(String[] args) throws IOException {
+ String parm = args.length > 0 ? args[0] : ".";
+ File dir = new File(parm);
+// System.out.println(dir.getCanonicalPath() + "\n");
+ Directory d = new Directory(null, dir);
+ String s = String.format("D %,16d", d.totalSize) + " " + d.fsdir.getCanonicalPath();
+ System.out.println(s);
+ recurse(d, 1);
+ }
+
+}
diff --git a/src/dev/rsems/treesize/s/Directory.scala b/src/dev/rsems/treesize/s/Directory.scala
new file mode 100755
index 0000000..fc434d3
--- /dev/null
+++ b/src/dev/rsems/treesize/s/Directory.scala
@@ -0,0 +1,23 @@
+package dev.rsems.treesize.s
+
+import java.io.File
+import java.nio.file.Files
+import scala.collection.mutable.ListBuffer
+
+class Directory(val fsdir: File, val parent: Directory = null, val sort: Boolean = false) {
+ private var localSize = 0L
+ var children = ListBuffer[Directory]()
+ private val files = fsdir.listFiles
+ if (files != null)
+ localSize = files.filter(f => f.isFile() && !Files.isSymbolicLink(f.toPath)).map(f => f.length).sum
+ var totalSize = localSize
+ private val dirs = fsdir.listFiles
+ if (dirs != null) {
+ totalSize += dirs.filter(f => f.isDirectory() && !Files.isSymbolicLink(f.toPath)).map(dir => {
+ val subdir = new Directory(dir, this, sort)
+ children += subdir
+ subdir.totalSize
+ }).sum
+ if (sort) children = children.sortBy(-_.totalSize)
+ }
+}
\ No newline at end of file
diff --git a/src/dev/rsems/treesize/s/Test.scala b/src/dev/rsems/treesize/s/Test.scala
new file mode 100755
index 0000000..4b79345
--- /dev/null
+++ b/src/dev/rsems/treesize/s/Test.scala
@@ -0,0 +1,48 @@
+package dev.rsems.treesize.s
+
+import java.io.File
+
+object Test extends App {
+ // ─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼
+ val LineUpAndRight = " \u2514\u2500\u2500 "; // " └── "
+ val LineBlank = " ";
+ val LineVerticalAndRight = " \u251c\u2500\u2500 "; // " ├── "
+ val LineVertical = " \u2502 "; // " │ "
+
+ def recurse(d: Directory, level: Int) {
+ for (child <- d.children) {
+ val ts = child.totalSize
+ val sb = new StringBuilder("%,16d ".format(ts))
+ var s = ""
+ var temp = child
+ var loop = 0
+ while (temp.parent != null) {
+ if (temp.parent.children.indexOf(temp) == temp.parent.children.size - 1) {
+ if (loop == 0) {
+ s = "└─ " + s
+ } else {
+ s = " " + s
+ }
+ } else if (loop == 0) {
+ s = "├─ " + s
+ } else {
+ s = "│ " + s
+ }
+ temp = temp.parent
+ loop += 1
+ }
+ sb.append(s).append(child.fsdir.getName)
+ println(sb.toString)
+
+ // if (level <= 4)
+
+ recurse(child, level + 1)
+
+ }
+ }
+
+ val dir = new Directory(new File(if (args.length > 0) args(0) else "."))
+ val s = "%,16d".format(dir.totalSize) + " " + dir.fsdir.getCanonicalPath
+ println(s)
+ recurse(dir, 1)
+}
\ No newline at end of file
diff --git a/treesize.iml b/treesize.iml
new file mode 100644
index 0000000..84c31ac
--- /dev/null
+++ b/treesize.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file