'List Files in a particular Directory Dim fs2, f2, s2, folderspec2, strFileName2, domain, parm1, parm2 parm1 ="dim wsh" parm2 = "set wsh = createobject(" & Chr(34) & "WScript.Shell" & Chr(34) & ")" 'Specify the path in which directory you want the list of files folderspec = "X:\LogFiles\domain.com\W3SVC1554341291" domain = "wsh.run(" & Chr(34) & "X:\gzip.exe -q1 X:\LogFiles\domain.com\W3SVC1554341291\" strFileName2 = "X:\LogFiles\domain.com\compress.domain.com.vbs" Set fs2 = CreateObject("Scripting.FileSystemObject") Set objMenuPage2 = fs2.createtextFile(strFileName2, True) Set f2 = fs2.GetFolder(folderspec) objMenuPage2.WriteLine parm1 objMenuPage2.WriteLine parm2 For Each FileName In f2.files s2 = s2 & domain s2 = s2 & fileName.name s2 = s2 & Chr(34) & ")" s2 = s2 & vbCrLf Next 'Close all objects, set to nothing to free up memory. objMenuPage2.WriteLine s2 objMenuPage2.Close set f2 = nothing set fs2 = nothing set objMenuPage2 = nothing