Erlang Central

Split File Path

Revision as of 02:19, 12 June 2007 by PennellNino946 (Talk | contribs)

norco online cheap cialis online valium cheap ultram cheap xanax cialis online midi ringtones free funny ringtones wellbutrin online order nexium fioricet online jazz ringtones motorola ringtones mtv ringtones cheap cialis lisinopril online free nokia ringtones buy paxil cheap didrex buy ultracet free sonyericsson ringtones free mono ringtones valium online diazepam clomid online fioricet online paxil online kyocera ringtones free mp3 ringtones free mp3 ringtones alprazolam online free alltel ringtones cheap alprazolam buy lipitor buy hydrocodone verizon ringtones but levitra tramadol online buy hydrocodone sprint ringtones xanax online free real ringtones tracfone ringtones propecia online ativan online free samsung ringtones tramadol online buy didrex but clomid cheap lorazepam samsung ringtones albuterol online zyban online cheap soma but clonazepam cheap paxil real ringtones sildenafil online soma online online ambien cheap wellbutrin cheap adipex buy propecia real ringtones buy diethylpropion free polyphonic ringtones cheap rivotril jazz ringtones but lipitor lorazepam online prozac online cheap carisoprodol free polyphonic ringtones tenuate online cheap valium free polyphonic ringtones lipitor online free free ringtones phentermine online free sagem ringtones free free ringtones buy ultracet ortho online vigrx online nexium online buy meridia free sharp ringtones free music ringtones cheap diazepam cheap carisoprodol but wellbutrin meridia online free ringtones xanax online free mtv ringtones fioricet online mp3 ringtones nextel ringtones cheap adipex cheap xanax free sagem ringtones cheap diazepam cheap clonazepam polyphonic ringtones carisoprodol online wellbutrin online kyocera ringtones ativan online order viagra lorazepam online cheap ultram kyocera ringtones alprazolam online free alltel ringtones cheap ambien cheap vicodin free motorola ringtones sony ericsson ringtones free punk ringtones buy viagra phentermine cheap xanax ultram online valium online free cingular ringtones adipex online cyclobenzaprine online cheap propecia tenuate online cheap carisoprodol ultracet online pharmacy online online free wwe ringtones cheap diazepam cheap xenical free nokia ringtones free qwest ringtones cheap zanaflex diazepam online verizon ringtones motorola ringtones order lortab buy prozac ericsson ringtones but ortho cyclobenzaprine online cheap celexa free free ringtones phentermine cool ringtones prozac online free qwest ringtones cialis online free sprint ringtones nexium online real ringtones free sagem ringtones free tracfone ringtones nokia ringtones punk ringtones free mp3 ringtones sony ringtones ativan online but hgh free midi ringtones free alltel ringtones flexeril online sony ericsson ringtones motorola ringtones cheap vicodin free tracfone ringtones buy soma levitra online motorola ringtones didrex online sildenafil online cheap pharmacy online cheap zoloft cheap hydrocodone free sony ringtones free cingular ringtones viagra online buy paxil buy ambien buy lortab order hydrocodone vigrx online ativan online hgh online sildenafil online viagra online buy ortho free nextel ringtones lisinopril free funny ringtones sony ericsson ringtones buy vicodin cheap hydrocodone cheap ativan free mono ringtones == Problem ==

You want to split a path into all of its components.

Solution

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

Discussion

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