Solved

Api or delphi function to have the previous directory

Posted on 1999-01-18
3
152 Views
Last Modified: 2010-04-04
Hi,
I want to know if a function or api exist to retreive the previous directory with a string like: 'c:\yes\itsok\'?
Thanks
0
Comment
Question by:mabell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1362412
What do you mean with the previous directory?

Perhaps you mean "ExtractFilePath"? Or "GetCurrentDir"?

Regards, Madshi.
0
 

Author Comment

by:mabell
ID: 1362413
I mean a function or api similar to extractfilepath but instead of cuting the file name
it cut the second directory. Exemple:  You call this   TheFunctionName('c:\temp1\temp2\')
and obtain this 'c:\temp1\' .
Thanks.
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1362414
This will do it...

function TheFunctionName(Path : string) : String;

begin
  if Path[length(path)] = '\' then
    Path := copy(path, 1, length(path) - 1);

  result := ExtractFilePath(Path);
end;

Cheers,

Raymond.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 93
Reconfigure Delphi Install? 2 77
Performance of SQL statement 37 147
MS Access from Delphi 31 102
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question