lookiart.blogg.se

Vbs get file path
Vbs get file path






‘ObjOutFile.WriteLine(“Folder,” & ObjFolder.Name & “,” & ObjFolder.Path) ObjOutFile.WriteLine(ObjFile.Name & “,” & ObjFile.Path) Set ObjFolder = fso.GetFolder(FolderName) ‘Call the GetFile function to get all files ‘ObjOutFile.WriteLine(“Type,File Name,File Path”) Set ObjOutFile = fso.CreateTextFile(“OutputFiles1.csv”) Set fso = CreateObject(“Scripting.FileSystemObject”) VBScript – List all the files in particular folder and its subfolders and put it into an excel sheet SaveToExcel searchText, searchPath, strExcelPath StrExcelPath = “D:\result.xls” ‘Specify the path for the output excel file ObjSheet.Cells(i, j).Value = targetfile.name Set TargetFolder = filesys.GetFolder(“D:\Folder\”) ‘Specify the path of folder from where you want to get file list Set filesys = CreateObject(“Scripting.FileSystemObject”)įilepath = filesys.GetAbsolutePathName(“”) Wscript.Echo “Excel application not found.” Set objExcel = CreateObject(“Excel.Application”) Sub saveToExcel(searchText, searchPath, strExcelPath) VBScript – List all the files in particular folder and put it into an excel sheet

vbs get file path

So instead of going to each folder and copy pasting the names of files, i wrote VBScript to do the same. These 587 java files were scattered in 96 different folders and sub folders. While preparing Inventory, I needed to list of all the java files.

vbs get file path vbs get file path

Today I want to share some useful VBScript.








Vbs get file path