473,395 Members | 1,869 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,395 software developers and data experts.

split firstname and xtension of a file

i have a file named abc.pcl

i want to convert it abc.dat

in c#.net how to do it. i am fetching this file from a directory, and i have to save it as abc.dat.

file name should be same, but extension is changed.

thanx.
neel.
Oct 4 '08 #1
3 1072
Curtis Rutland
3,256 Expert 2GB
System.IO.FileInfo can do everything you need.

The properties you will need are FullName, Name, and Extension. The method you can use is CopyTo(newPathString).

If you need information on those members, there is a link at the bottom of the MSDN page I linked you to.
Oct 4 '08 #2
i have done this,

string sFile;
string fDoctype;
string opt;
sFile = "D:\\processedpcl\\ARG.OUT.WIRE.INFO0.doc";
string pfile = "D:\\processedfile" + "\\" + sFile;
fDoctype = pfile.Substring(pfile.LastIndexOf("\\") + 1);
Console.WriteLine(fDoctype);
opt = fDoctype.Substring(0, 3);
Console.WriteLine(opt);
Oct 21 '08 #3
r035198x
13,262 8TB
i have done this,

string sFile;
string fDoctype;
string opt;
sFile = "D:\\processedpcl\\ARG.OUT.WIRE.INFO0.doc";
string pfile = "D:\\processedfile" + "\\" + sFile;
fDoctype = pfile.Substring(pfile.LastIndexOf("\\") + 1);
Console.WriteLine(fDoctype);
opt = fDoctype.Substring(0, 3);
Console.WriteLine(opt);
There is really no need for all that reed dancing with that substring. Read insert's post above again.
Oct 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SL_McManus | last post by:
Hi All; I am fairly new to Perl. I have a file with close to 3000 lines that I would like to split out in a certain way. I would like to put the record type starting in column 1 for 2 spaces,...
6
by: JLM | last post by:
Haven't seen this question yet. I have a field that has "LastName,FirstName". I want to split that field into two, based on the comma. Size of LastName is obviously different in each record,...
2
by: michellep | last post by:
I have an excel spreadsheet that I imported into Access, and there is a Name field in the format of last name, first name. I'd like to break this into 2 separate fields. How can I do this? TIA!
3
by: John Salerno | last post by:
This is an example in the book I'm reading: string fullName = " Edward C Koop "; fullName = fullName.Trim(); string names = fullName.Split(' '); string firstName = names; //...
3
by: Stephan Bour | last post by:
I have a string ³Name² in the following format: ³LastName, FirstName (Department)² that comes from Active Directory. I need to extract the FirstName from the string. Substrings are not practical...
8
by: J Stoodley | last post by:
I am in a learning curve right now, and want to become well aquanted with VB.NET. So, I have two questions. 1 is technial the other is resource related. 1. I need to strip a single character...
4
by: peashoe | last post by:
Can anyone help me with a simple split problem. I've never done it before and I have no clue. I have value sSearch = Lastname Firstname I need to split it into two separate field: sLast =...
2
by: Shawn Minisall | last post by:
I'm trying to unpack a list of 5 floats from a list read from a file and python is telling me 5 variables are too many for the string.split statement. Anyone have any other idea's? NOTE: the only...
2
by: SpecialKay | last post by:
hey guys, regarding some syntax for Split() function: string fullName = "Smith, John" string FullName = fullName.Split(new char { ','}); string LastName = FullName; string FirstName =...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.