Saber el nombre de un fichero conociendo toda su ruta

2055 vistas

Para poder extraer el nombre de un fichero conociendo su path completo tendremos que usar la clase System.IO.Path y su método GetFileName.



vbnet
  1. Dim fileName As String = "C:\toto.tx"
  2. Dim name As String = System.IO.Path.GetFileName(fileName)
  3. Console.WriteLine(name)