Re: use pathname for SetDirectory
- To: mathgroup at smc.vnet.net
- Subject: [mg15665] Re: use pathname for SetDirectory
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 30 Jan 1999 04:28:57 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <78pao4$ct0@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Witold
I can't try your \\ example but on my SGI the following works
DirFromFileName[filepath_String]:=
ToFileName[
Drop[
Apply[
StringJoin,
Split[
Characters[filepath],
#=!=$PathnameSeparator &
],
{1}
] ,
-1
]
]
Hope that helps
Jens
wgrebe wrote:
>
> Hallo,
>
> I have written a program which calls Mathematica via MathLink. However,
> the answere of my question needn't has to do with MathLink. In my
> program I read out the pathname from a FileDialog, for example
> "C:\FILES\TEXT.DAT"
> and send it to a package in Mathematica. Here (in the
> Mathematica-Package) I want to use it in a SetDirectory-command without
> the filename at the end and with double ' \':
> "C:\\FILES".
> Of course for the the conversion " \ -> \\ " I can call StringReplace
> but how can I get rid of the filename?
> Or does somebody have a different solution for my problem?
>
> Thank you
>
> Witold
> wgrebe at cityweb.de