goflatten
is a utility that flattens a nested directory of files into a flat one.
For example, suppose that you have this structure:
pricelist
-> 2019-01-01
-> 2019-01-01.csv
-> 2019-01-02
-> 2019-01-02.csv
After running goflatten
the resulting structure is:
pricelist
-> 2019-01-01.csv
-> 2019-01-02.csv
-> 2019-01-01
-> 2019-01-02
To install goflatten
run:
go get -u github.com/ShiraazMoollatjie/goflatten
Thereafter, you can simply run:
goflatten
The following flags exist for goflatten
:
-
dryRun - If set to
false
,goflatten
will physically move nested files to the root directory. This is set totrue
by default. -
rootDir - Specifies the starting root directory. By default, the current working directory is the starting directory.
-
skipDupes - If set to
true
, duplicate files will not be overwritten when moving them to the root directory. By default, this is set totrue
.