473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

get filename from filepath

Hi all,
What is the best way to get the file name from the filepath.

For example: I want to get "MyDoc001.xml" from "C:\MyDocs\MyDoc001.xml".

Thanks.
-Nikhil
Nov 16 '05 #1
3 44297
TJO
Path.GetFileName(string fullpath);

"Nikhil Patel" <do*******@nospaml.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi all,
What is the best way to get the file name from the filepath.

For example: I want to get "MyDoc001.xml" from "C:\MyDocs\MyDoc001.xml".

Thanks.
-Nikhil

Nov 16 '05 #2
See the System.IO.Path class and it's static methods, like

System.IO.Path.GetFileName( @"c:\mydocs\mydoc001.xml")

--
-Philip Rieck
http://philiprieck.com/blog/

-
"Nikhil Patel" <do*******@nospaml.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi all,
What is the best way to get the file name from the filepath.

For example: I want to get "MyDoc001.xml" from "C:\MyDocs\MyDoc001.xml".

Thanks.
-Nikhil

Nov 16 '05 #3
Thanks all for your answers.

"Nikhil Patel" <do*******@nospaml.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi all,
What is the best way to get the file name from the filepath.

For example: I want to get "MyDoc001.xml" from "C:\MyDocs\MyDoc001.xml".

Thanks.
-Nikhil

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: mjakowlew | last post by:
Hi, I'm trying to use some string manipulation from a file's path. filepath='c:\documents\web\zope\file.ext' I need to extract everthing after the last '\' and save it. I've looked around...
5
by: starritt | last post by:
I have to create a view where the filename is seperated from the path to the file. Examples of the data include: m:\images\big\myimg.jpg m:\images\medium\myimg.jpg...
3
by: Darrel | last post by:
using Request.FilePath will return the entire file path: directory/directory/myfile.aspx Is there a built function in ASP.net to grab just the filename (myfile.aspx) or do I need to write...
0
by: the_programming_paddy | last post by:
I'm using VWD Express 2005. Sometimes I'll have a number of pages open that are all related and make calls to each other at different times. As I'm going through the code of one, I'll come to a...
3
by: Ramon F Herrera | last post by:
My application receives a filepath as an argument. Obviously, it can come in several formats, such as: filename.ext ..\filename.ext ...\..\filename.ext this\is_a\relative\path\finally.ext
3
by: Hamayun Khan | last post by:
I have Two asp pages addfiles.asp insert.asp addfiles.asp is used to browse the files which i want to upload to server. in IE both the pages run and the files uploads ok. There is...
2
by: AdrianJ1980 | last post by:
Hi all, Apologies if this has been discussed before, but my numerous searches (google and otherwise) have come up with nothing. What i need to do is open a word document (from Access 2003),...
0
by: rajib123 | last post by:
I am trying to write a windows utility that downloads some files from an ftp site to a local directory and then uploads those files to another ftp site. The files that I need to download are posted...
2
by: indona | last post by:
hi.. i am trying to pass the file path of a text file, which i need to read, to a file object so as to read all lines of the text file. and i am selecting the file through a filedialog and i...
3
by: Chuck Beck | last post by:
I am struggling with this issue right now. I have read in a number of places that you should not store the image itself in the database, but rather only the filepath/filename. I can't seem to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.