Re: Problems with DirectoryName

• To: mathgroup at smc.vnet.net
• Subject: [mg65708] Re: Problems with DirectoryName
• From: "David Reiss" <dbreiss at gmail.com>
• Date: Sun, 16 Apr 2006 01:45:15 -0400 (EDT)
• References: <e1ikg1\$3si\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

Hi Janko,

DirectoryName takes a path in the syntax for a path in the computer OS
that it is executed in and returns a Directory name in that same
syntax.  If you give it a path in the syntax of another computer's OS
then it simply thinks that you have given it a pure string (with no
\$PathnameSeparator appearing in it) and hence returns the Blank that
you wittnessed in your second case.

Cheers,

David

Janko Slavic wrote:
> Hi!
>
> I would like to get the directory name out of a full path filename
> string.
> It seems like the DirectoryName is not working the same with "\\" or
> "/".
>
> DirectoryName["d:\\temp\\test.txt"] => d:\temp\
> DirectoryName["d:/temp/test.txt"] => Blank
>
> I would like the solution to be platform independent.
> Any advices are greatly appreciated!

• Prev by Date: Re: NDSolve
• Next by Date: Re: bug in Partition?
• Previous by thread: Problems with DirectoryName
• Next by thread: Reaction-diffusion PDEs