DEV Community

Cover image for Merge files in a path with goMerge
Javad Rajabzadeh for Gopher

Posted on

4 2

Merge files in a path with goMerge

goMerge

Merge some files in a path with custom extension in golang

GitHub logo Ja7ad / goMerge

Merge some files in a path with custom extension in golang

goMerge

Go Reference

Merge some files in a path with custom extension in golang

goMerge

Feature

  • Walk in a path with a goroutine using parallelism
  • Merge files with custom extension
  • Remove unmerged files with remove flag

Install goMerge

go get -u github.com/Ja7ad/goMerge

Example

package main

import (
    fileMerger "github.com/Ja7ad/goMerge"
    "log"
)

func main() {
    err := fileMerger.Merge("./test", ".log", "./test/merged.txt", true)
    if err != nil {
        log.Fatal(err)
    }
}
Enter fullscreen mode Exit fullscreen mode



Feature

  • Walk in a path with a goroutine using parallelism
  • Merge files with custom extension
  • Remove unmerged files with remove flag

Install goMerge

go get -u github.com/Ja7ad/goMerge

Example

package main

import (
    fileMerger "github.com/Ja7ad/goMerge"
    "log"
)

func main() {
    err := fileMerger.Merge("./test", ".log", "./test/merged.txt", true)
    if err != nil {
        log.Fatal(err)
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
solaiman_dev profile image
solaiman

hi

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️