Reputation: 469
I have that string ...
C:\Users\ApplicationData\Folder1\Myapp.exe
How could i cut like:
C:\Users\ApplicationData\Folder1
I have tried s.split("\Myapp.exe")
, where s
is C:\Users\ApplicationData\Folder1\Myapp.exe
Plase help me, thanks.
Upvotes: 0
Views: 340
Reputation: 323
you can use the System.IO.FileInfo class.
It contains a function FullName, which returns the directory full name.
check this link
Upvotes: 1
Reputation: 64923
Use the Path
class:
Path.GetDirectoryName("C:\Users\ApplicationData\Folder1\Myapp.exe")
Check it here:
Upvotes: 11