Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

How to remove .extension from a System.IO.FileInfo file ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gamesforums@hotmail.com - 03 Oct 2007 11:51 GMT
How can i remove the .sql extension from my script files?? I want to
read all scripts in directory into a hashtable, and use
Right(scriptFile.FullName, 3) as my key and full name as value:

'buildscript_001.sql
'buildscript_002.sql

'Want to have 001 as key and buildscript_001.sql as value.

       Dim scriptDirectory As New IO.DirectoryInfo "C:\Applications
\MyApplicationMainline\SW\App\DatabaseScripts\BuildScripts\")

       Dim scriptFileList As IO.FileInfo() =
scriptDirectory.GetFiles()
       Dim scriptFile As IO.FileInfo
       Dim scriptFileTable As New Hashtable

       For Each scriptFile In scriptFileList
           'Read scripts to Hash tbl..
           scriptFileTable.Add(Right(scriptFile.FullName, 3),
scriptFile.FullName)
       Next

Regards
Mcad
Mark Rae [MVP] - 03 Oct 2007 12:02 GMT
> How can i remove the .sql extension from my script files??

http://msdn2.microsoft.com/en-us/library/system.io.path.getfilenamewithoutextens
ion(vs.80).aspx


Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

RB - 03 Oct 2007 12:05 GMT
> How can i remove the .sql extension from my script files?? I want to
> read all scripts in directory into a hashtable, and use
[quoted text clipped - 21 lines]
> Regards
> Mcad

Check here:
http://msdn2.microsoft.com/en-us/library/system.io.path_members.aspx

Particularly look at GetFileNameWithoutExtension :-)
gamesforums@hotmail.com - 03 Oct 2007 12:16 GMT
> gamesfor...@hotmail.com wrote:
> > How can i remove the .sql extension from my script files?? I want to
[quoted text clipped - 28 lines]
>
> - Vis sitert tekst -

Thanx, solved it:)!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.