none
How to Retrive the file name from given file path? RRS feed

  • Question

  • The file path:

    "C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text  Search\ItemFinder\Documents\Crank Arm and Tire Maintenance.doc"

    I want to retrive  only file name (i.e.Crank Arm and Tire Maintenance.doc) from above file path

    Monday, May 20, 2013 7:06 AM

Answers

  • This forum is for discussions and questions regarding profiles and Microsoft's recognition system on the MSDN and TechNet sites. It is not for products/technologies.

    As it's off topic here, I am moving the question to the "Where is the forum for..." forum.

    You really need to tell us what technology you are using however.

    In Windows PowerShell you can do this:

    Split-Path "C:\Program Files\Microsoft SQL Server\MSSQL.1\Samples\Microsoft SQL Server Engine Samples\Full Text  Search\ItemFinder\Documents\Crank Arm and Tire Maintenance.doc" -Leaf

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    Tuesday, May 21, 2013 2:12 PM
    Moderator