Results 1 to 2 of 2

Thread: How do I remove the directory structure in file name in this function?

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    63

    Question How do I remove the directory structure in file name in this function?

    Hello,

    I am listing files in a certain directory into a list box using the following code I found on this Forum (Thanks mpdeglau).

    lstFiles.Items.AddRange(System.IO.Directory.GetFiles("C:\Test Files\Data Entry Process\", "*.XLS", IO.SearchOption.TopDirectoryOnly))

    The file names are then listsed in the the list box but the problem is that it also includes the direcotry path also. like this.

    C:\Test Files\Data Entry Process\test.xls

    How do I have it not include the directory structure? so it would then just show

    test.xls

    Is there an option to do this?

    Thanks for your help

    Mythos
    Last edited by Mythos44; Nov 2nd, 2007 at 03:03 PM. Reason: a little clearer title

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width