Thread: Getting just the filename from a path

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    Path.GetFilename(...)

    or if u wanna do it string search way:
    Code:
    string[] split = path.Split('\\');
    string filename = split[split.Length - 1];
    and of course check for errors in the input string.

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    85
    thanks Bling - sorted

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 04-11-2009, 01:49 AM
  2. Using string operations to save part of a file path
    By JackR in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2007, 03:48 PM
  3. user defined path for FILENAME
    By drdigimon in forum C Programming
    Replies: 5
    Last Post: 10-12-2003, 06:04 PM
  4. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM
  5. getting a file's path and filename
    By face_master in forum Windows Programming
    Replies: 4
    Last Post: 02-05-2002, 01:44 PM