3
For example, I have file addresses:
C:/windows/x.exe
C:/windwos/system32/example.exe
I would like to replace the file name and extension with "", so:
C:/Windows/
C:/windows/system32/
3
For example, I have file addresses:
C:/windows/x.exe
C:/windwos/system32/example.exe
I would like to replace the file name and extension with "", so:
C:/Windows/
C:/windows/system32/
6
You can use the method Path.Getdirectoryname
var path1 = @"C:/windows/x.exe";
var path2 = @"C:/windwos/system32/exemplo.exe";
Console.WriteLine(Path.GetDirectoryName(path1) + Path.DirectorySeparatorChar);
Console.WriteLine(Path.GetDirectoryName(path2) + Path.DirectorySeparatorChar);
It worked. Thank you!
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.
This address would be stored in a String ?
– Anderson
I’m doing a search and throwing the results in a var: var Subfile = Directory.Getfiles(path, "*. csproj", Chopseartion.Alldirectories);
– João Paulo Pulga