Thursday, August 3, 2017

How to print directory structure using groovy

import static groovy.io.FileType.*

def root = new File('/some/directory/here')
def tab = 0
root.traverse(
    type         : ANY,
    preDir       : { tab++ },
    postDir      : { tab-- }
    ) { f ->
    
    (0..tab).each { print "|---" }
    println "\\_" + f.name
}
Sample Result:
> groovy dirTree.groovy
|---\_.classpath
|---\_.project
|---\_.settings
|---|---\_org.eclipse.jdt.core.prefs
|---|---\_org.eclipse.jdt.groovy.core.prefs
|---\_bin
|---|---\_com
|---|---|---\_aquian
|---|---|---|---\_main
|---|---|---|---|---\_Main.class
|---|---|---|---\_modules
|---|---|---|---|---\_WriterModule.class
|---\_src
|---|---\_com
|---|---|---\_aquian
|---|---|---|---\_main
|---|---|---|---|---\_Main.groovy
|---|---|---|---\_modules
|---|---|---|---|---\_WriterModule.groovy

Wednesday, March 2, 2016

My custom kanban board

This is my custom KANBAN board made from Microsoft Access & complex vba code.

POS to a friend

Made this simple POS to a friend. There are plenty rooms for improvement but it get the job done. ;)