[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get directory name?

From: Lennart Borgman (gmail)
Subject: Re: Get directory name?
Date: Wed, 27 Aug 2008 22:44:28 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Lennart Borgman (gmail) wrote:
> I can't find a good way to get the last directory name from a directory
> path using the current functions for file name handling. There must be
> some way ...?
> file-name-nondirectory does not work for a directory path (or, rather it
> returns "" which is not what I want). Maybe there should be a
> (defun  directory-last-name (directory)
>   "Returns the last name in a directory path.
> ..."

Some more thoughts: Actually it can be implemented like this

(defun  directory-last-name (directory)
  "Returns the last name in a directory path."
   (expand-file-name "."
                     (file-name-as-directory directory))))

At least that works on w32. Any thoughts on adding this?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]