e r l a n g : c o o k b o o k

/ Erlang.FileSplitPath

This Web


WebHome 
WebChanges 
TOC
NewRecipe 
WebTopicList 
WebStatistics 

All Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Erlang Links


Erlang.org
Erlang Wiki
ErlMan
Erlang Wiki
The Jungerl
Erlang-fr.org
Joe Armstrong
Lambda the Ultimate

Erlang Web Ring


[Prev]: Joe Armstrong's Page
[Next]: Joe Armstrong's Page

Splitting a Path into All of Its Parts

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: 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

Contributors

Based on work by GordonWeakliem.

-- BrentAFulgham - 01 Sep 2004

CookbookForm
TopicType: Recipe
ParentTopic: FileRecipes
TopicOrder: 050

 
 
Copyright © 2004 by the contributing authors. All material on the Erlang Cookbook web site is the property of the contributing authors.
This material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest