Home  |  Delphi .net Home  |  System.IO.Directory  |  GetParent Method
  
GetParent  
Method  
Gets the parent Directory (folder) name of the specified Path
Directory Class
System.IO NameSpace
NotCF1.  Function GetParent ( PathString : String ) : DirectoryInfo; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns the parent Directory (folder) to the specified PathString as a DirectoryInfo object.
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
References
DirectoryInfo
Microsoft MSDN Links
System.IO
System.IO.Directory
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
Getting the current folder name and its parent folder name
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  Path : String;

begin
  // Get the current folder
  Path := System.IO.Directory.GetCurrentDirectory;
  Console.WriteLine(Path);

  // Get the parent folder
  Console.WriteLine(System.IO.Directory.GetParent(Path));

  Console.Readline;
end.
   C:\Documents and Settings\Neil\My Documents\Borland Studio Projects
   C:\Documents and Settings\Neil\My Documents
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author