Adblock breaks this site

Need help

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

  1. cooladrrang

    cooladrrang Active Member

    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0
    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)
     
  2. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Need help

    I have some code that i used for my media player that may help, i find and post
     
  3. cooladrrang

    cooladrrang Active Member

    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0
    Need help

    i solved the first part of cahnge text.ini to text.mas but the otehr is more difficult
     
  4. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    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
     
  5. cooladrrang

    cooladrrang Active Member

    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0
    Need help

    how do i use that
     
  6. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    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
    
     
  7. cooladrrang

    cooladrrang Active Member

    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0
    Need help

    huh? balblabla
     
  8. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Need help

    If u really don't get it, the download is below
     
  9. cooladrrang

    cooladrrang Active Member

    Joined:
    Jan 21, 2007
    Posts:
    125
    Referrals:
    0
    Sythe Gold:
    0
    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
     
  10. X Zero

    X Zero Forum Addict

    Joined:
    Jan 21, 2007
    Posts:
    577
    Referrals:
    0
    Sythe Gold:
    0
    Need help

    ya or that lol

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


 
 
Adblock breaks this site