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
|
|---|