Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic [VB] (http://www.go4expert.com/articles/visual-basic-tutorials/)
-   -   List All Files in Folder using VBScript (http://www.go4expert.com/articles/list-files-folder-using-vbscript-t927/)

kaiwen21 31Jul2011 00:39

Re: List All Files in Folder using VBScript
 
Awesome script thanks

Is it possible however to split the filename into different columns in an excel table.

for e.g. the file is "001 - his name is known.mkv"

and want to split it as follows:
Column A: 001
Column B: his name is known

and drop the file extension from the file list

AutosysR11 10Apr2012 16:34

Re: List All Files in Folder using VBScript
 
Hello,

I am beginner in vbscript. Can someone help me to resolve my problem. I was trying to export all files in C:\windows with the file extension of .log and will list the file to Filelist.txt under the same path (c:\windows).

pramodmhn 15Oct2014 05:37

Re: List All Files in Folder using VBScript
 
I will do this way:
Set objFso = CreateObject("Scripting.FileSystemObject")
Set Folder = objFSO.GetFolder(".")
Set NewFile = objFSO.CreateTextFile(Folder&"\FileList.txt", True)
For Each File In Folder.Files
'sNewFile = File.Name'including extension
NewFile.WriteLine(left(File.Name,(len(File.Name)-4)))'exclude extenstion
Next


All times are GMT +5.5. The time now is 22:41.