Need help

Discussion in 'Programming General' started by cooladrrang, Aug 14, 2007.

Need help
  1. Unread #1 - Aug 14, 2007 at 1:12 AM
  2. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Need help

    i want a program to locate at C:\ text.ini and want to convert it to text.mas how can i do that and also find all files in C:\ that start with &!&
    to convert to .mas instead of .ini

    (files starint with &!& are like this &!&textheremightchange!&!.ini change that to &!&textheremightchange!&!.mas thats all i want to do plz help)
     
  3. Unread #2 - Aug 14, 2007 at 1:22 AM
  4. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Need help

    I have some code that i used for my media player that may help, i find and post
     
  5. Unread #3 - Aug 14, 2007 at 1:28 AM
  6. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Need help

    i solved the first part of cahnge text.ini to text.mas but the otehr is more difficult
     
  7. Unread #4 - Aug 14, 2007 at 1:30 AM
  8. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Need help

    ok, import "Imports System.IO"

    Code:
        Sub ListFiles()
            Dim a
            Dim b
            On Error Resume Next
            Dim filInfo As FileInfo
            Dim FEn As IEnumerator
            Dim str(2) As String
            For Each fil As String In Directory.GetFiles("C:\")
                filInfo = New FileInfo(fil)
                a = filInfo.FullName
                Dim x As Integer = a.LastIndexOf("\") + 1
                Dim Name As String = a.Substring(x)
                x = Name.LastIndexOf(".")
                Name = Name.Substring(0, x)
                b = Name
                x = Nothing
                Name = Nothing
                str(1) = filInfo.FullName
                str(0) = b
                If a.EndsWith("ini") Then
                    MsgBox(str(0))
                Else
                End If
            Next
        End Sub
     
  9. Unread #5 - Aug 14, 2007 at 1:32 AM
  10. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Need help

    how do i use that
     
  11. Unread #6 - Aug 14, 2007 at 1:33 AM
  12. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Need help

    If u use this, it will list all the files in the "C:\" with the extention .mas

    Code:
    Imports System.IO
    Public Class Form1
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ListFiles()
        End Sub
        Sub ListFiles()
            Dim a
            Dim b
            On Error Resume Next
            Dim filInfo As FileInfo
            Dim FEn As IEnumerator
            Dim str(2) As String
            For Each fil As String In Directory.GetFiles("C:\")
                filInfo = New FileInfo(fil)
                a = filInfo.FullName
                Dim x As Integer = a.LastIndexOf("\") + 1
                Dim Name As String = a.Substring(x)
                x = Name.LastIndexOf(".")
                Name = Name.Substring(0, x)
                b = Name
                x = Nothing
                Name = Nothing
                str(1) = filInfo.FullName
                str(0) = b
                If a.EndsWith("mas") Then
                    MsgBox(str(0))
                Else
                End If
            Next
        End Sub
    End Class
    
     
  13. Unread #7 - Aug 14, 2007 at 1:35 AM
  14. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Need help

    huh? balblabla
     
  15. Unread #8 - Aug 14, 2007 at 1:39 AM
  16. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Need help

    If u really don't get it, the download is below
     
  17. Unread #9 - Aug 14, 2007 at 1:46 AM
  18. cooladrrang
    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0

    cooladrrang Active Member

    Need help

    soolved this is easier
    For Each filePath As String In IO.Directory.GetFiles("folder path here", "&!&*.ini")
    IO.File.Move(filePath, IO.Path.ChangeExtension(filePath, ".mas"))
    Next filePath
     
  19. Unread #10 - Aug 14, 2007 at 1:56 AM
  20. X Zero
    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0

    X Zero Forum Addict

    Need help

    ya or that lol

    looks like it solves both in 3 line :)
     
< [C++] My First Script [BASIC] | Help! >

Users viewing this thread
1 guest


 
 
Adblock breaks this site