> > |
%META:TOPICINFO{author="BrentAFulgham" date="1093997854" format="1.0" version="1.1"}%
You want to split a path into all of its components.
The split function in the Erlang standard library module file will do this.
1> filename:split("C:\\winnt\\system32\\drivers\\etc").
["c:/","winnt","system32","drivers","etc"] |
You may want to find the path from the root directory to the item of interest. To do so, you will need to convert any relative pathnames to absolute path names, using the filename:absname function:
1> filename:split( filename:absname( "..\\..\\winnt\\system32\\drivers\\etc" )).
["c:/",
"Program Files",
"erl5.3.6.3",
"..",
"..",
"winnt",
"system32",
"drivers",
"etc"]
Based on work by GordonWeakliem.
-- BrentAFulgham - 01 Sep 2004
%META:FORM{name="CookbookForm"}%
%META:FIELD{name="TopicType" title="TopicType" value="Recipe"}%
%META:FIELD{name="ParentTopic" title="ParentTopic" value="FileRecipes"}%
%META:FIELD{name="TopicOrder" title="TopicOrder" value="050"}% |