in reply to Dynamically creating a folder hierarchy

It's kind of unweildy, but it can be done as a "one liner". Assumes the list of paths are in junk.dat:

perl -MList::Util=reduce -nle"$p{reduce{$p{$a}=1;$a=qq[$a/$::b]}split'/'}=1}{print for sort key +s%p" junk.dat /admin /admin/test /core /core/system /core/system/init.conf /demo /demo/test /demo/test/core /demo/test/core/newfile.cgi /demo/test/file1234.cgi

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."