N
Nan Wang
Let's say I have a list of directories:
a/b/c
a/b/c/d
a/b/c/e
a/b/o
a/c
a/c/q
a/x
a/x/y
I'm trying to find the most efficient way to parse this list and come up
with the fewest mkpath call. In other words, only mkpath the leaf nodes:
a/b/c/d
a/b/c/e
a/b/o
a/c/q
a/x/y
So far I'm parsing the list, then for each path, find the parent directory,
use that as the key of a hash, and increment it by 1 for each path under that
key, and only call mkpath on the hash elements with a value of 0. Is there a
better way of doing this?
Thanks in advance.
a/b/c
a/b/c/d
a/b/c/e
a/b/o
a/c
a/c/q
a/x
a/x/y
I'm trying to find the most efficient way to parse this list and come up
with the fewest mkpath call. In other words, only mkpath the leaf nodes:
a/b/c/d
a/b/c/e
a/b/o
a/c/q
a/x/y
So far I'm parsing the list, then for each path, find the parent directory,
use that as the key of a hash, and increment it by 1 for each path under that
key, and only call mkpath on the hash elements with a value of 0. Is there a
better way of doing this?
Thanks in advance.