I have a script that will read each file on a folder and create a text file which contains the filename and path for each file in the folder.I would like to change this scrip to create a comma delimited file using the filename as the data source for example my file name is:
F2MA 212001800A2 F01 4.tif
I would like the text file to look like this:
"F2MA212001800A2","F01","4",";E:\F2MA 212001800A2 F01 4.tif"
Any help will be appreciated I guess what I really need is a little push understanding the Left, Mid and Right syntax . here is what I have so far:
F2MA 212001800A2 F01 4.tif
I would like the text file to look like this:
"F2MA212001800A2","F01","4",";E:\F2MA 212001800A2 F01 4.tif"
Any help will be appreciated I guess what I really need is a little push understanding the Left, Mid and Right syntax . here is what I have so far:
Code:
Option Explicit
'on error resume next
Dim objFSO
Dim objFolder
Dim colFiles
Dim objSubFolder
Dim objSubFile
Dim strFolder
Dim File
Dim objFile
Dim colFolders
Dim path
Dim filecreate
Dim filetxt
Dim strLine
Dim input
Dim WriteStuff
'Input = InputBox("Enter folder path")
strFolder = "E:\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
Set colFiles = objFolder.Files
filetxt= "N:\Resources\Scripts and Stuff\Read Folder Files.txt"
Set WriteStuff = objFSO.OpenTextFile(filetxt, 8, True)
For Each File in colFiles
set objFile = objFSO.GetFile(strFolder & "\" & File.Name)
WriteStuff.WriteLine(left(objFile.name,40)& "," & objFile.Path)
Next
set objFSO = Nothing
set objFolder = Nothing
set colFiles = Nothing
set objSubFolder = Nothing
set objSubFile = Nothing
set strFolder = Nothing
set File = Nothing
set objFile = Nothing
set colFolders = Nothing
set path = Nothing
set filecreate = Nothing
set filetxt = Nothing
set strLine = Nothing
set input = Nothing
set WriteStuff = Nothing
wscript.Quit