Search code examples
gremlintinkerpoptinkerpop3janusgraph

How can I get all the file names under one folder using gremlin?


How can I get all the file names under one file folder? and foreach all the file names? using gremlin command


Solution

  • Gremlin is a graph traversal language. It doesn't have specific commands for reading the file system. You would just use the features of your programming language to do that. With Groovy, you could just do:

    gremlin> new File("data").eachFile(groovy.io.FileType.FILES) { println it.name }
    tinkerpop-modern.json
    tinkerpop-classic.kryo
    ...
    script-input.groovy