john6000

does anyone know how to cut the file name off a path so im just left with a path


Many thanks



Re: Visual C# General Path name help

Andrej Tozon

Hi,

try Path.GetDirectoryName():

string file = @"c:\myfolder\myfile.txt";
string folder = Path
.GetDirectoryName(file);
string filename = Path.GetFileName(file);

Andrej






Re: Visual C# General Path name help

john6000

Andrej Tozon wrote:

Hi,

try Path.GetDirectoryName():

string file = @"c:\myfolder\myfile.txt";
string folder = Path
.GetDirectoryName(file);
string filename = Path.GetFileName(file);

Andrej



Thanks, this Path. is really useful.