1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Copy files from a text file from given a parameters in a .ini using VBScript

Discussion in 'Visual Basic ( VB )' started by AutosysR11, Apr 12, 2012.

  1. AutosysR11

    AutosysR11 New Member

    Joined:
    Apr 10, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I was trying to resolve my issue in listing a files from a text file to another folder. The script open a file named ".ini" which contain a parameters. The script will use the parameters to copy all files from the list file.
    Code:
    Dim export_file, item, path, extension
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    Set objPath = objFSO.GetFolder(path)
    
    Set objNewFile = objFSO.CreateTextFile(export_file, True)
    
    sExtension = objFso.GetExtensionName(extension)
    
    Set colFiles = objPath.Files
                   For Each Item in colFiles
                   If objFSO.GetExtensionName(Item.Name) = sExtension Then 
                   objNewFile.WriteLine Item.Name
                   End If
    	Next
    
    objNewFile.Close
     
    Last edited by a moderator: Apr 13, 2012

Share This Page